|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Can a named template return a node list?
Thanks. I want to use a named template to avoid putting certain XPath
statements in multiple locations. Maybe there is a better way.
Since I don't think there is a pure XSL solution I have been trying with node-set, but that's not working for me either. This seems to give no output; I am pretty sure the solution is something obvious but I don't see it. <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"> <xsl:template match="*">
<xsl:variable name="somedata">
<xsl:call-template name="sometemplate" />
</xsl:variable>
<xsl:variable name="somenode" select="msxsl:node-set( $somedata )" />
<xsl:value-of select="$somenode/@attr" />
</xsl:template><xsl:template name="sometemplate"> <xsl:copy-of select="/root/node1" /> </xsl:template> </xsl:stylesheet> And the sample data again: <root>
<node1 attr="node1attrval">
<node1a>node1atext</node1a>
</node1>
<node2 attr="node1attrval">
<node2a>node2atext</node2a>
</node2>
</root>David Carlisle wrote:
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








