Adrian Herscu schrieb am 22.06.2010 um 14:46 (+0300):
> <!-- create a copy of interesting things -->
> <xsl:variable name="sections">
> <xsl:for-each select="descendant::section">
> <xsl:copy>
> <xsl:copy-of select="@* />
> </xsl:copy>
> </xsl:for-each>
> </xsl:variable>
Given your input document, you could simplify this to:
<!-- create a copy of interesting things -->
<xsl:variable name="sections">
<xsl:copy-of select="descendant::section"/>
</xsl:variable>
> <document-report>
> <xsl:for-each
> select="xalan:nodeset($sections)/section[utils:dummy(true())][1]">
> <!-- NOTE: the ancestors are no longer available -->
> <section-report ref="{...@ref}" />
> </xsl:for-each>
> </document-report>
> </xsl:template>
>
> Any explanation?
No other than a wild guess that one XPath expression is optimized,
and another isn't.
--
Michael Ludwig