You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Rajal Shah <ra...@scmail.ectone.com> on 2000/06/27 01:35:11 UTC

Getting the node name.

How can I extract the element tag names using XSL? (vaguely remember
that IE supports it using nodename() or something..)

eg.

<set>
   <Price>100</Price>
    <Quantity>2</Quantity>
</set>

What I would like to do is extract all the children element names of
"set". In this case, it should be "Price" and "Quantity".

A possible xsl template is:

<xsl:template match="set">
    <xsl:for-each select="from-children(.)">
        !!nodename!! = <xsl:value-of select="."/>
    </xsl:for-each>
</xsl:template>

Thanks.
--
Rajal



RE: Getting the node name.

Posted by Linda Derezinski <li...@interfacecontrol.com>.
If you have <tag NAME="george"/> 
use <xsl:value-of select="@NAME" /> to get george
<xsl:value-of select="name(.)" /> to get tag
-Linda Derezinski

 -----Original Message-----
From: 	Rajal Shah [mailto:rajal@scmail.ectone.com] 
Sent:	Monday, June 26, 2000 7:35 PM
To:	Xalan mailing list
Subject:	Getting the node name.

How can I extract the element tag names using XSL? (vaguely remember
that IE supports it using nodename() or something..)

eg.

<set>
   <Price>100</Price>
    <Quantity>2</Quantity>
</set>

What I would like to do is extract all the children element names of
"set". In this case, it should be "Price" and "Quantity".

A possible xsl template is:

<xsl:template match="set">
    <xsl:for-each select="from-children(.)">
        !!nodename!! = <xsl:value-of select="."/>
    </xsl:for-each>
</xsl:template>

Thanks.
--
Rajal