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 ')
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.
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" />
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.
Comment