[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] saxon:evaluate and external documents
Subject: [xsl] saxon:evaluate and external documents From: "Scott Lynch" <slynch@xxxxxxxxxx> Date: Fri, 13 Apr 2007 18:24:01 -0400 |
All, I'm having problems with saxon:evaluate (Saxon 8.8) when using a document reference. In a nutshell, I want to display the data in the document being transformed along side the same type of data from an external document. Both documents use the same structure, therefore I want to use the same xpath to query the various data, but when I attempt to use saxon:evaluate with the document variable in the string to evaluate, it doesn't seem to process the document path properly (seems to ignore the document portion of the path string altogether). Here's the xslt: The "new_and_old" template is called from the main template. Here's the code snippet from the main template: <xsl:call-template name="new_and_old"> <xsl:with-param name="value_xpath">foo/bar/@version</xsl:with-param> </xsl:call-template> Here's the template I'm attempting to use to build output using data from both sources. <xsl:template name="new_and_old"> <xsl:param name="value_xpath"/> <xsl:variable name="compare_file" select="document('doc_2.xml')"/> <DataVersions> <xsl:value-of select="saxon:evaluate($value_xpath)"/> <xsl:text/> <!-- <xsl:value-of select="saxon:evaluate(concat($compare_file,'/',$value_xpath))"/> --> <!-- <xsl:value-of select="saxon:evaluate($delta_xpath)"/> --> <!-- <xsl:value-of select="saxon:evaluate(concat('$contentDoc', $p1), $path)"/> --> <!-- <xsl:value-of select="saxon:evaluate(concat('$compare_file',$p1),$value_xpath)"/> --> <!-- <xsl:value-of select="saxon:evaluate(concat('$p1', $value_xpath), $compare_file)"/> --> <!-- <xsl:value-of select="$compare_file/saxon:evaluate($value_xpath)"/> --> </DataVersions> </xsl:template> Both XML files (the one being transformed explicitly and the compare_file) have the same structure. A simple example: Source doc: <foo> <bar version="1"/> </foo> Compare doc (doc_2.xml): <foo> <bar version="2"/> </foo> The first saxon:evaluate function (uncommented) works fine. I've been googling like mad and have tried lots of different saxon:evaluate calls which include the $compare_file document variable, but none of them work. The first commented example is the closest to working, but returns the version value in the source document rather than the compare_file document. I know there are restrictions for saxon:evaluate regarding variables, but I can't seem to find the right web page which lays out the restrictions (and any workarounds) in any detail. Any help would be appreciated. Scott Lynch
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Re: [xsl] XSLT Subtract functio, Dimitre Novatchev | Thread | RE: [xsl] saxon:evaluate and extern, Scott Lynch |
Re: [xsl] Pre-rendering Output, omprakashv | Date | [xsl] Web 2.0 Expo, Kevin Farnham |
Month |