Re: [xsl] How to refer to the tag name

Subject: Re: [xsl] How to refer to the tag name
From: "cutlass" <cutlass@xxxxxxxxxxx>
Date: Mon, 16 Jul 2001 14:41:34 +0100
u may use the name() function to get the name of the current node

cheers, jim fuller
----- Original Message ----- 
From: "Lajos Moczar" <lmocz@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, July 16, 2001 2:33 PM
Subject: [xsl] How to refer to the tag name


> Hi all. I think (hope!) this is a simple question ...
> 
> I have a stylesheet in which I want to refer to the tag name, not the 
> tag contents. My XML is built dynamically as a result of a database 
> query and looks like this:
> 
> <row>
>   <id>1</id>
>   <name>Tom</name>
>   <dob>19800322</dob>
> </row>
> <row>
>    ...
> </row>
> 
> I simply want to build column headers based on the names of the column 
> tags - id, name, dob. So I have a template rule to match the first 
> occurance of <row>:
> 
> <xsl:template match="row[position()=1]">
>    <tr bgcolor="#666699">
>      <xsl:for-each select="*">
>       <td class="base-text"><font color="#FFFFFF"><center><b>
>        <!-- What goes here? -->
>       </b></center></font></td>
>      </xsl:for-each>
>    </tr>
>    <tr>
>      <xsl:apply-templates/>
>    </tr>
> </xsl:template>
> 
> 
> All I need is to get the name of each child tag of the row element as I 
> loop through with <xsl:for-each>. Any ideas?
> 
> Thanks in advance.
> 
> Lajos Moczar
> galatea.com
> 
> 
>  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