Find the name of the element

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SenileOwl
    New Member
    • Feb 2008
    • 27

    Find the name of the element

    I'm very new to XML and I'm trying to find a way to refer to an elements name. The main goal is to create a table of contents.

    I am using a key to grab all of the elements that have the attribute (class='heading ')
    Code:
     <xsl:key name="TOCnames" match="//*" use="@class" />
    I then cycle through the node, displaying the name attribute. <xsl:value-of select="@name"/>.

    What I'd like to do, is indent each name differently depending on what element they came from. A Chapter element would be indented more than a volume element. I don't know how to test the element and find out what kind of element it is. I'm assuming it is a simple answer, but I can't seem to find it anywhere.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    it's the XPath function name() or local-name()

    Comment

    Working...