[xsl] Convert a node-set to a string

Subject: [xsl] Convert a node-set to a string
From: David Frey <dpfrey@xxxxxxx>
Date: Fri, 25 Mar 2011 11:00:20 -0700
Is it possible to get a string from a node-set in XSLT 1.1?

Say I have some XML like this (completely made up):

<Inventory>
<Item price="10" quantity="7" name="widget"/>
<Item price="4" quantity="3" name="chair"/>
</Inventory>


And then I define a template like this:


<xsl:template match="Item">
<xsl:variable name="item" select="."/>
<xsl:variable name="len" select="ext:someExtensionFunction($item)"/>
<Length><xsl:value-of select="$len"/></Length>
</xsl:template>

The problem I think I am having is that my extension function expects a string, but I am passing it a node-set. I want to convert the node-set to a string rather than changing the extension function to accept a node-set as a parameter. Is this possible?

Thanks,
Dave

Current Thread