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]

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

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