RE: Sorting Issue

Subject: RE: Sorting Issue
From: "Jon Wynacht" <jwynacht@xxxxxxxxx>
Date: Mon, 11 Sep 2000 14:25:07 -0700
Mike,

Thanks for the reply. I've cleaned up the xsl a bit based on your feedback
and now have the following:

http://www.switchlight2239.com/temp/vtreport.xsl

to transform this xml:

http://www.switchlight2239.com/temp/vtreport.xml

However, when I sort by the Modification Date column, it "kind of" works.
Here is the output:

http://www.switchlight2239.com/temp/vtreport.html

Any ideas?

Thanks again for the help here...

Jon

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Mike Brown
Sent: Wednesday, September 06, 2000 4:40 PM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: Re: Sorting Issue


Jon Wynacht wrote:
> http://www.switchlight2239.com/temp/vtreport_sort.txt
> PS - I'm using the old namespace because I'm using the old parser (v0185)

Good thing you said this. I was about to comment on it. :)

> I declare an xsl:param at the top of the page and set it to 1; this would
> normally get set by a servlet, but for development I'm just setting it
> manually.

Looks fine. You're setting it to default to a result tree fragment
containing a root node and a text node, but this shouldn't matter when you
compare it to the number 1; it will be interpreted like
<xsl:if test="number($sort) = 1">

> My second template matches PXML and test for the value of $sort, the
param,
> and applies the other template and sorts it all by Title.

Without seeing your XML, it's hard to say. The way you have it written in
the part that' snot commented out, you're saying to go process the child
nodes of the PXML element, in order dictated by *their* child elements
named Title. It implies that you have

 <PXML>
   <something> <!-- the things you are sorting = something -->
     <Title>foo</Title>
   </something>
   <something>
     <Title>bar</Title>
   </something>
   ...
 </PXML>

In the template that matches "/*" (the document element) you are saying to
process the child elements, and if you uncomment that xsl:sort, you'll
ensure that it's done in order by their child elements named Title. Again,
it implies that the nodes you are applying the sort to have child elements
named Title.

Is this really the case?

Also, no need to use choose/when if there's only one condition; use if.
Although you might want to keep it there and throw in an xsl:otherwise so
you can see if the test is failing.


   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at         My XML/XSL resources:
webb.net in Denver, Colorado, USA           http://www.skew.org/xml/


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


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


Current Thread