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

RE: name of attributes like name() function for elemen

Subject: RE: name of attributes like name() function for elements?
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 5 Dec 2002 13:11:53 -0000
xsl attribute name function
The name() function returns the name of any node (elements, attributes,
etc). You can supply the node as an argument, or let it default to the
context node.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Georges Schmitz
> Sent: 05 December 2002 12:45
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  name of attributes like name() function for elements?
> 
> 
> Hi all,
> 
> Is it possible to get the name of an attribute in the same 
> way, as with the name() function for elements?
> 
> Problem:
> 
> When merging to files - in my case RelaxNG with some 
> proprietary extensions residing in a seperate file - I use a 
> key function to retrieve the content of an element node of 
> the extension file:
> 
> <xsl:key name="insert.template.elem" match="*" use="name()"/>
> 
> and applying it this way:
> 
> <xsl:template match="@* |node()" mode="copy.rng" >
> <xsl:choose>
>    <xsl:when test="name()='element' ">
>      <xsl:element name="{name()}">
>        <xsl:variable name="elem.name" select="@name"/>
>        <xsl:attribute name="name"><xsl:value-of select="$elem.name"/>
>        </xsl:attribute>
>        <sm:map>
>          <sm:item table="kennungen">
>            <xsl:attribute name="field">
>              <xsl:for-each select="$insertTemplate"><xsl:value-of 
> select="key('insert.template.elem',$elem.name)"/></xsl:for-each>
>            </xsl:attribute>
>          </sm:item>
>        </sm:map>
>        <xsl:apply-templates mode="copy.rng"/>
>      </xsl:element>
>    </xsl:when>
> ...
> 
> But there is also information stored in attributes I need to 
> retrieve in a similar way. How can this be accomplished? I'm 
> imagining something like the following:
> 
> <xsl:key name="insert.template.attr" match="@*" use="attr-name()"/>
>                                             ^^^^      ^^^^
>                                         something like this! 
> and then applying it again this way:
> 
> ...
>    <xsl:when test="name()='attribute' ">
>      <xsl:element name="{name()}">
>        <xsl:variable name="attr.name" select="@name"/>
>        <xsl:attribute name="name"><xsl:value-of select="$attr.name"/>
>        </xsl:attribute>
>        <sm:map>
>          <sm:item table="kennungen">
>            <xsl:attribute name="field">
>              <xsl:for-each select="$insertTemplate"><xsl:value-of 
> select="key('insert.template.attr',$attr.name)"/></xsl:for-each>
>            </xsl:attribute>
>          </sm:item>
>        </sm:map>
>        <xsl:apply-templates mode="copy.rng"/>
>      </xsl:element>
>    </xsl:when>
> ...
> 
> 
> Thanks in advance,
> Georges
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 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.