This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Getting max attribute value of an element by attribute value...


I have the following substructure in an XML file I'm working with.

<classes>
	<class name="Fighter" short="Ftr" level="1" hp="10"
uri="../class/fighter.xml"/>
	<class name="Rogue" short="Rog" level="1" hp="3"
uri="../class/rogue.xml"/>
	<class name="Fighter" short="Ftr" level="2" hp="5"
uri="../class/fighter.xml"/>
</classes>


I'm trying to get this as the output.

Ftr(2), Rog(1)


Currently, I can only figure out how to get this:

Ftr(1), Rog(1), Ftr(2)


The template I'm using currently stands as:

<xsl:template name="listClasses">
	<xsl:for-each select="classes/class">
		<xsl:value-of select="@short"/>(<xsl:value-of
select="@level"/>)<xsl:if test="not(position() = last())">, </xsl:if>
	</xsl:for-each>
</xsl:template>


How can I change the template to sort the <class>es so they are all grouped
with the first appearance of the class, and I only get the highest level of
the class inside the parenthesis?

	- Theo

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]