Hi,
I hope you can help. This example should hopefully explain my problem.
I have an XML document (the default document) that contains a list of XML files and an XPath expression in an attribute for each one. Each file is loaded by the match="/" template in a for-each loop using the document function to load the XML into a variable.
I then call <apply-templates select="fileDoc" mode="copy"/>
This copies each file (and does some filtering but I'm not concerned about that in this example). However, I need to reference the XPath of the file that I've stored in a variable in the main for-each loop but isn't accessible from the
Code:
<xsl:template match="*" mode="copy">
or
Code:
<xsl:template match="@*" mode="copy">
templates as I can't pass paramters.
I'm using Saxon so have access to XSLT / XPath 2.0 functionality. I have tried to use saxon:assign but failed totally to get it to work as the
function fails to look up the variable saying
Code:
"Variable $msgCtx has not been declared"
Also, this simple xsl
Code:
<xsl:variable name="myXPath" select="'/'"/>
<xsl:variable name="result" select="saxon:expression($myXPath)"/>
<xsl:message>Result = <xsl:copy-of select="$result"/></xsl:message>
produces
Code:
Result = net.sf.saxon.functions.Evaluate$PreparedExpression@179f36b
as output!?
Can anyone help?
Thanks.