On 20/07/2010 21:17, Nathan Potter wrote:
The key() function, when called with two arguments, always searches
within the current document (more accurately, the document containing
the context node). Your xsl:for-each changes the current document, so
you are searching the wrong thing. In XSLT 2.0 you can use the third
argument of the key() function to indicate which document you want to
search.
I've included some other comments on your code in case you find them
helpful.
<xsl:choose>
<xsl:when test="boolean(dataset)">
Calling boolean() is redundant here: the test attribute does it anyway.
<xsl:element name="NestedDataset">
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
That's a rather longwinded way of doing
<NestedDataSet name="{(_at_)name}"><xsl:apply-templates/></NestedDataSet>
<xsl:variable name="sName"><xsl:value-of select="."/></xsl:variable>
You can almost invariably rewrite this as <xsl:variable name="sName"
select="."/> (or perhaps select="string(.)"). This isn't just a
stylistic issue, it's a lot more efficient to bind a variable to a node
or a string than to construct a temporary tree.
Michael Kay
Saxonica
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--