This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: keys and unique IDs
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] keys and unique IDs
- From: Wendell Piez <wapiez at mulberrytech dot com>
- Date: Mon, 19 Mar 2001 12:31:58 +0000
- References: <BNEMICIEADHDDOIKLHNCAEKGDMAA.elenz@xyzfind.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Robert,
If I understand you correctly, you don't need to.
generate-id() will always give the same value for a given node on a given
run of a stylesheet. The key is unnecessary -- just access generate-id() again.
Cheers,
Wendell
At 03:22 PM 3/19/01, you wrote:
>Is there a way to generate unique IDs for each node in an XML document and
>then when you match that node can you retrieve the key's value (the UID)?
>For example:
>
><xsl:key name="allnodes" match="*" use="generate-id()"/>
>
><xsl:template match="/">
> <style type="text/css">
> <xsl:apply-templates mode="x"/>
> </style>
> <xsl:apply-templates mode="y"/>
></xsl:template>
>
><xsl:template match="*" mode="x">
> <xsl:variable name="this.nodes.key" select="???"/>
> #<xsl:value-of select="$this.nodes.key"/> {yadayada}
></xsl:template>
>
><xsl:template match="*" mode="y">
> <xsl:variable name="this.nodes.key" select="???"/>
> <div id="{$this.nodes.key}">
> whatever
> </div>
></xsl:template>
>
>Thanks
>
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list