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

Re: keys and unique IDs

Subject: Re: keys and unique IDs
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Mon, 19 Mar 2001 07:52:53 -0800
css unique ids
Ahhh... nevermind... I think I can do what I need with:

<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:param name="x.oldpos"/>
   <xsl:variable name="pos" select="position()"/>
    <xsl:variable name="x.pos" select="concat($x.oldpos,$pos)"/>

     #<xsl:value-of select="concat(name(),$x.pos)"/> {yadayada}
     <xsl:apply-templates mode="x">
         <xsl:with-param name="x.oldpos" select="$x.pos"/>
     </xsl:apply-templates>
</xsl:template>

<xsl:template match="*" mode="y">
   <xsl:param name="y.oldpos"/>
    <xsl:variable name="pos" select="position()"/>
    <xsl:variable name="y.pos" select="concat($y.oldpos,$pos)"/>
    <div id="{concat(name(),$y.pos)}">
         whatever
         <xsl:apply-templates mode="y">
            <xsl:with-param name="y.oldpos" select="$y.pos"/>
         </xsl:apply-templates>
    </div>
</xsl:template>




----- Original Message -----
From: "Robert Koberg" <rob@xxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, March 19, 2001 7:22 AM
Subject: keys and unique IDs


> 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


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.