|
[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
-----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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








