Re: [xslt] problem with variables that are nodesets



Try this:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                            xmlns:libxslt="http://xmlsoft.org/XSLT/namespace">

> <xsl:template match="/">
>   <xsl:variable name="foo">
>     <xsl:element name="node">
>       <xsl:attribute name="id">bar1</xsl:attribute>
>       <xsl:text>a test node</xsl:text>
>     </xsl:element>
>   </xsl:variable>
>
>   <xsl:copy-of
> select="$foo"/><xsl:text>&#010;</xsl:text>
>     <xsl:value-of
> select="$foo"/><xsl:text>&#010;</xsl:text>
>     <xsl:value-of
<!-- ************* -->
 select="libxslt:node-set($foo)/node/@id"/><xsl:text>&#010;</xsl:text>
<!--- *************** -->
> </xsl:template>

I think in new versions of xsltproc this should work.

Bernhard





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