Extracting element names for output

Subject: Extracting element names for output
From: Vernon_Imrich@xxxxxxxxxxxxxx
Date: Fri, 18 Jun 1999 20:04:54 -0400
Is there any support in XSL for extracting the NAME of the XML element (or node)
as the generated text rather than the value of the node? (For that matter, how
about extracting the names of all the element attributes; again, rather than the
value of the element attributes?) Hopefully, it would be something like
<xsl:name-of  select="." />

I want to create a stylesheet that shows formatted element names in the final
output, no matter what those element names are in the input XML.  This is for
output where only the node context (node structure) of the element matters, not
the name.

For example applying the stylesheet to:

<Person>
      <Firstname>Joe</First>
      <Lastname>Blow</Last>
</Person>

would produce:

<P><B>Person</B></P>
<table>
<tr><td>Firstname</td><td>Lastname</td></tr>
<tr><td>Joe</td><td>Blow</td></tr>
</table>

But using the SAME stylesheet applied to:

<Employee>
      <Surname>Joe</Surname>
      <Familyname>Blow</Familyname>
</Employee>

would produce:

<P><B>Employee</B></P>
<table>
<tr><td>Surname</td><td>Familyname</td></tr>
<tr><td>Joe</td><td>Blow</td></tr>
</table>

I can successfully create the various match and select expressions for the
stylesheet based only on node context.  But I can't seem to actually output or
format the nodes and element names themselves.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread