extracting element-names

Subject: extracting element-names
From: "Ben Jung" <benjamin.jung@xxxxxxxxx>
Date: Mon, 5 Apr 1999 15:28:21 +0100
I am having problems to extract element-names from XML documents with XSL
stylesheets:

Assuming, I have the following XML fragment:
---------------
<Person>
  <Name>Ben</Name>
  <Age>5</Age>
  <Country>Ireland</Country>
</Person>
---------------

Next: I want to create the following 'table':
---------------
Name: Ben
Age: 5
Country: Ireland
---------------

This XSL stylesheet does the job, BUT only if I know the element-names!
If the XML source document changes (e.g. another child <City>Galway</City>
is included), I would have to change the XSL, too.
---------------
<xsl:for-each select="Person">
  Name: <xsl:value-of select="Name"/>
  Age: <xsl:value-of select="Age"/>
  Country: <xsl:value-of select="Country"/>
</xsl:for-each>
-----------------

Any ideas?
Ben


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


Current Thread