getting attribute as column headers
Posted
by edwards
on Stack Overflow
See other posts from Stack Overflow
or by edwards
Published on 2010-04-09T16:32:30Z
Indexed on
2010/04/09
20:53 UTC
Read the original article
Hit count: 273
xslt
I have the following XML:
<DEVICEMESSAGES>
<VERSION xml="1" checksum="" revision="0" envision="33050000" device="" />
<HEADER id1="0001" id2="0001" content="Nasher[<messageid>]: <!payload>" />
<MESSAGE level="7" parse="1" parsedefvalue="1" tableid="15" id1="24682" id2="24682" eventcategory="1003010000" content="Access to <webpage> was blocked due to its category (<info> by <hostname>)" />
</DEVICEMESSAGES>
I am using the following XSLT:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:strip-space elements="*"/>
<xsl:template match="DEVICEMESSAGES/HEADERS">
<xsl:value-of select="@id2"/>,<xsl:text/>
<xsl:value-of select="@content"/>,<xsl:text/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
I get the following output:
0001 , Nasher[<messageid>]: <!payload>
whereas I need the column headings, too:
id2, content
0001 , Nasher[<messageid>]: <!payload>
© Stack Overflow or respective owner