Sign In/My Account | View Cart  
advertisement

Article:
 What's New in XPath 2.0
Subject: getting attribute names of an XML element
Date: 2002-04-07 16:09:41
From: Morgan Nagarajan

Is there any provisions to display the attribute names of an XML element. It's easy to get an attribute value but I could not find any easy way at all to get the names of the attribute (note that I don't know attribute name existing in a XML element, beforehand)
For example, consider an XML element,
<CurrentStatus
ServiceHealth="Available"/> I wanna print the attribute name (ie ServiceHealth) by means of XPath in XSLT stylesheet.
any help?
thanks,
-Morgan

No Previous Message Previous Message   Next Message Next Message


Titles Only Titles Only Newest First
  • getting attribute names of an XML element
    2002-04-16 10:11:23 Bernhard Zwischenbrugger

    Try this:


    <xsl:for-each select="/CurrentStatus/@*">
    <xsl:value-of select="name()"/>
    </xsl:for-each>


    Hope it helps


    Bernhard Zwischenbrugger
    http://datenkueche.com


Sponsored By: