[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: understanding generate-id and node-equality [XSLT

Subject: Re: understanding generate-id and node-equality [XSLT 1.0, Saxon 6.5.5]
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 14 Aug 2008 11:40:16 -0400
Re:  understanding generate-id  and node-equality [XSLT
At 2008-08-14 17:19 +0200, christoph.naber@xxxxxxxxxxx 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@xxxxxxxxxxxxxxxxxxxx
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.