[xslt] Passing xml expressions as parameters.
- From: "Bob Stobie" <bstobie axsone com>
- To: <xslt gnome org>
- Subject: [xslt] Passing xml expressions as parameters.
- Date: Wed, 7 Jul 2004 10:45:38 -0400
Hi All,
I have raised this before, and it applies to the now one release old
versions of libXML2 and libXSLT.
I have a moderately large XSLT application (the xsl file > 4500 lines) which
has been running under Windows with a MS Scripting engine driver written in
JScript. The script calls the translation in an interative fashion. I am
converting it to Perl to run on Linux/Solaris.
The author elected to pass an XML expression containing run time data as a
parameter to the XSLT. I have found that the XML control characters, <, >,
" get escaped to <, > etc. before they they are processed in the
translation. This happens whether I enclose the XML string is quotes or
not. As a result, the XPath expressions to retrieve these values do not
work.
To make sure this was not an artifact of the Perl wrapper, I modified the
CPAN c code immediately before it calls xsltApplyStyleSheet to log the
parameter string it is passing. At that point it is OK. I have traced the
calls in the libXSLT code as far back as xmlXPathCompiledEval, which appears
to be in the core LibXML2 code, and up to that point I cannot see anything
that would do this.
Basically, is this a feature? If so, is there anything I can do to disable
this?
Creating a very simple test case I pass in
<state sequence="0"><info/><action
name="start"/><result><shellArgs/></result><notify/></state>
The parameter I pass in is
<abcd>ABCD</abcd>
The style sheet is
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="maConfig"/>
<xsl:template match="/">
<xsl:copy-of select="." />
<xsl:copy-of select="$maConfig" />
</xsl:template>
</xsl:stylesheet>
The log result I get from my fprintf statement immediately before the call
to xsltApplyStyleSheet is
Parameter is '<abcd>ABCD</abcd>'
>From Perl, printing out the result of the translation I get
<?xml version="1.0"?>
<state sequence="0"><info/><action
name="start"/><result><shellArgs/></result><notify/></state>
<abcd>ABCD</abcd>
Any suggestions would be much appreciated.
Bob Stobie
bstobie axsone com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]