xsl-list
[Top] [All Lists]

Re: [xsl] understanding generate-id and node-equality [XSLT 1.0, Saxon 6.5.5]

2008-08-14 08:41:12
At 2008-08-14 17:19 +0200, christoph(_dot_)naber(_at_)daimler(_dot_)com wrote:
using XSLT 1.0 and Saxon 6.5.5 I'm wondering whats the actual difference
between

<xsl:key name="child-key" match="child" use="parent::*"/>

<xsl:template match="parent" >
        <xsl:variable name="childs" select="key('child-key', parent::*)"/>
        ...
</xsl:template>

and

<xsl:key name="child-key" match="child" use="generate-id(parent::*)" />

<xsl:template match="parent" >
        <xsl:variable name="childs" select="key('child-key',
generate-id(parent::*))" />
        ...
</xsl:template>

I think I know what generate-id does,

The XSLT processor guarantees that all nodes of all source trees of a given transformation process have unique generated identifiers. Every time (in one process) you ask for the generated identifier for a node you get the same value, which will be different than the value returned for any other node.

No guarantee is made between two executions of the same stylesheet for the same source tree, only within either one of those executions.

but what is tested when I use the
former expression?

You are testing the string value of the concatenation in document order of all descendent text nodes of the parent of the node being added to the key table.

I hope this helps.

. . . . . . . . . Ken

--
Upcoming XSLT/XSL-FO hands-on courses:      Wellington, NZ 2009-01
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>