[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

HowTo - Nested for-each XSLSort on multi-column displa

Subject: HowTo - Nested for-each XSLSort on multi-column display
From: jdgarrett@xxxxxxxxxx
Date: Tue, 10 Apr 2001 12:09:38 -0500
xslsort

-----Original Message-----
From: jdgarrett@xxxxxxxxxx [mailto:jdgarrett@xxxxxxxxxx]
Sent: Tuesday, April 10, 2001 11:54 AM
To: xml-dev@xxxxxxxxxxxxx
Subject: multi-column XSL:sort


Hey all...

Given the following XML source...
I need to construct the table that follows
but with the caveat that the PetNames are sorted
rather than just arranged in "document order"...

so I first have a xsl:for-each outer loop on
for each BreedType/Type (sorted of course) and then
I have an inner xsl:for-each loop on Type 
that also has a sort on the PetName attribute and
then shows just the PetName and the Age

(Note: so far I can do this when I do not
invoke any sorting on the inner for-each ...that
is ...I just loop through the document order
on Type...using select for the first column(PetName)
and following-sibling:: for the next column(Age)....
but I have yet to find a method in XSLT that will
let me sort on PetName and be able to access
the following-sibling element for the next sequence
of columns....

And yes I own Mike Kay's book .....

Does anyone know of a solution for this problem...

Sincerely
Jim Garrett
jdgarrett@xxxxxxxxxx
=======================================================================

<Dogs>
    <BreedTypes>
        <Type>x</Type>
        <Type>y</Type>
        <Type>r</Type>
        <Type>t</Type>
        <Type>a</Type>
        <Type>d</Type>
    </BreedTypes>
    <DogName>
        <DogAge  Type="x" PetName="PetDog" >3</DogAge>
        <DogAge  Type="y" PetName="GuardsNothing">21</DogAge>
        <DogAge  Type="x" PetName="SnozzesAllDayLong">15</DogAge>
        <DogAge  Type="y" PetName="JustEats">5</DogAge>
        <DogAge  Type="y" PetName="DigsALot">8</DogAge>
        <DogAge  Type="x" PetName="Runner">7</DogAge>
        <DogAge  Type="x" PetName="Sleepy">5</DogAge>
        <DogAge  Type="r" PetName="Howler">4</DogAge>
        <DogAge  Type="t" PetName="Dog">3</DogAge>
        <DogAge  Type="xPetName="Bucket">2</DogAge>
    </DogName>
<Dogs>


so I want to be able to create the following table ..


BreedType = a

    (column 1)        (column 2)    (column 3)    (column 4)
        PetName         Age          PetName        Age  
-------------------------------------------------------------------------



BreedType = d
    (column 1)        (column 2)    (column 3)    (column 4)
        PetName         Age          PetName        Age  



-------------------------------------------------------------------------

BreedType = r
    (column 1)        (column 2)    (column 3)    (column 4)
        PetName         Age          PetName        Age  



-------------------------------------------------------------------------

BreedType = t
    (column 1)        (column 2)    (column 3)    (column 4)
        PetName         Age          PetName        Age  



-------------------------------------------------------------------------

BreedType = x
    (column 1)        (column 2)    (column 3)    (column 4)
        PetName         Age          PetName        Age  



-------------------------------------------------------------------------

BreedType = y
    (column 1)        (column 2)    (column 3)    (column 4)
        PetName         Age          PetName        Age  



-------------------------------------------------------------------------



        


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.