This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
How to refer to the tag name
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] How to refer to the tag name
- From: Lajos Moczar <lmocz at galatea dot com>
- Date: Mon, 16 Jul 2001 07:33:11 -0600
- Reply-To: xsl-list at lists dot mulberrytech dot com
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