Subject: Unique attribute values
From: "Sean Tiley" <sean.tiley@xxxxxxxxx>
Date: Thu, 10 Jan 2008 11:34:21 -0500
|
Hi there,
I have the following structure in an XML file
<root>
<file name="c:\test.java">
<error line="4" message="Message1" severity="2"/>
<error line="67" message="Message2" severity="4"/>
</file>
<file name="c:\code.java">
<error line="2" message="Message1" severity="2"/>
<error line="54" message="Message2" severity="4"/>
<error line="122" message="Message1" severity="2"/>
<error line="124" message="Message2" severity="4"/>
</file>
</root>
What I want to do is the following.
I want a list of the unique values for the message attribute
I then want to output attribute value and the number of times it
appears in the file.
I can successfully get the count for an attribute value by using
<xsl:value-of select="count(/root/file/error[@message='Message1'])"/>
but I am hardcoding the 'Message1" which is clearly not optimal
Any suggestions are greatly appreciated
Thanks
Sean
|