This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to refer to the tag name


u may use the name() function to get the name of the current node

cheers, jim fuller
----- Original Message ----- 
From: "Lajos Moczar" <lmocz@galatea.com>
To: <xsl-list@lists.mulberrytech.com>
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]