Re: [xslt] Xpath on variables?



Daniel Veillard wrote:


>   this looks really wrong at least
>   <xsl:copy-of select="{$foo}/PATH"/>
> 
>   seems required 


Libxsl doesn't like the {$foo} at that place:


Error xpath.c:6566: Invalid expression
{$foo}//BAR
^
Error xpath.c:9123: Invalid expression
{$foo}//BAR
^
xsl:copy-of : could not compile select expression '{$foo}//BAR'


 >

and this may have to be cast to a node-set()
> if $foo is a result tree fragment.


How?

This is my (now stripped down) XSL-Sheet:



<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        version="1.0">


<xsl:template match="/">

<xsl:variable name="foo">
<FOO>
        <BAR arg="1">
        test
        </BAR>
</FOO>
</xsl:variable>

<xsl:copy-of select="$foo//BAR"/>

</xsl:template>

</xsl:stylesheet>



Xalan-C:

testXSLT -in foo.xml -xsl foo.xsl
========= Parsing foo.xsl ==========
Parse of foo.xsl took 0 milliseconds
========= Parsing foo.xml ==========
Parse of foo.xml took 10 milliseconds
=============================
Transforming...
<?xml version="1.0" encoding="UTF-8"?>
<BAR arg="1">
         test
         </BAR>
transform took 10 milliseconds

Total time took 20 milliseconds



Saxon 6.4.3:


velop@projects:/export/development/xslt/xslt-heiko > saxon foo.xml foo.xsl
<?xml version="1.0" encoding="utf-8"?><BAR arg="1">
        test
        </BAR>


develop@projects:/export/development/xslt/xslt-heiko >


libxslt 1.0.0:

xsltproc foo.xsl foo.xml
Error xpath.c:7416: Invalid type
Error xpath.c:7416: Invalid type



-- 
Heiko W. Rupp
Project Management
WiredMinds Informationssysteme GmbH
Wilhelmsplatz 11
D-70182 Stuttgart

Email: Heiko.Rupp@WiredMinds.de
Phone: +49 711 49048-232
Fax:   +49 711 49048-111





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]