Re: [xsl] Sorting and attributes

Subject: Re: [xsl] Sorting and attributes
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 17 Dec 2001 18:44:50 +0000
Hi Mike,

> Here is my xsl:
>
> <xsl:for-each select="//C02//PERSNAME">
>   <xsl:sort select="."/>
>     <LI>
>       <xsl:value-of select="."/>
>       <xsl:text>&#x20;&#x20;&#x20;&#x20;&#x20;:&#x20;</xsl:text>
>       <xsl:value-of select="./@ENCODINGANALOG"/>
>     </LI>
> </xsl:for-each>
>
> I have over 3000 entries, I just want to know if I am getting the
> output I think I am getting.

Can't you tell by looking at the output whether you are getting the
output you think you are getting?!? :) If not, perhaps you should try
working on a sample file containing fewer entries to start with?

All I can tell you is what the above does:

  It finds all the PERSNAME elements that are within a CO2 element
  within the document.

  It sorts the PERSNAME elements alphabetically by their string value
  (their content).

  It creates a <LI> element for each PERSNAME in sorted order.

  Within the LI element it gives the value of that PERSNAME element,
  followed by six spaces, followed by the value of the ENCODINGANALOG
  attribute on that PERSNAME element.

The value of the ENCODINGANALOG attribute does not affect the order in
which the PERSNAME elements are processed.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread