Retrieve element name

kip.cvpw

New Member
\[code\]<Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Package ID="b7137f2> <Compatibility_Rules ID="32fd84b4-7b9b-40e2-8265-8e2e4f856a8d"> <Rule_Event ID="992f04cb-6bd1-42bb-9578-87793dd38aca"> <Name>Entity Selection</Name> </Rule_Event><Rule_Name>Private Line Exclusions</Rule_Name> <Rule_Statement ID="d0cc0700-2199-4a51-af68-72dfe27d878f"> <Description>Package is Private line</Description> </Rule_Statement></Compatibility_Rules></Package></Root>\[/code\]I want to extract the attribute name "Rule Event" and display it as :\[code\]<attribute depth="0"> <name>Compatibility Rules</name> <value GUID="B7137F2"> <attributes> <attribute depth="1"> <name>Rule Event</name> <value GUID="32FD84B4"> <attributes/> </value> </attribute> </attributes> </value> </attribute>\[/code\]I tried the following but name() returns the parent of Rule Event i.e Compatibility Rules.\[code\] <xsl:template match="Compatibility_Rules"> <attribute depth="0"> <name> <xsl:value-of select="local-name()"/> </name> <value GUID="{../../*/@ID}"></value> <attributes> <attribute depth="1"> <name><xsl:value-of select="name()"/> </name> </attribute> </attributes> </attribute> </xsl:template> \[/code\]How can I get to Rule Event. I am totally new to XML and XSL.
 
Back
Top