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

Antw: Using Foreach with Attribute values

Subject: Antw: Using Foreach with Attribute values
From: agnes.kielen@xxxxxxx
Date: Wed, 10 Dec 2003 13:18:51 +0100
foreach cat
Hi Manuel,
This is called a grouping problem. Take a look at: http://www.jenitennison.com/xslt/grouping/index.html and
http://www.dpawson.co.uk/xsl/sect2/N4486.html

Cheers,
Agnes

> 
> Van: "Manuel Reyes" <Manuel.Reyes@xxxxxxxxx>
> Aan: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Datum: wo 10 dec 03, 12:57
> Onderwerp:  Using Foreach with Attribute values
> 
> I am attempting to merge an XSL and XML file to generate a PDF, and I
> have encountered a problem that I can't find a solution to.
> 
> The XML file that I am working with has the following format:
> 
> <data>
>   <products>
>     <product category="Cat 1">
>       <value1>valA</value1>
>       <value2>valB</value2>
>     </product>
>     <product category="Cat 2">
>       <value1>valC</value1>
>       <value2>valD</value2>
>     </product>
>     <product category="Cat 3">
>       <value1>valE</value1>
>       <value2>valF</value2>
>     </product>
>     <product category="Cat 2">
>       <value1>valG</value1>
>       <value2>valH</value2>
>     </product>
>   </products>
> </data>
> 
> As you can see there are 2 products of type "Cat 2", now what I am
> attempting to achieve is to create a PDF (using Apache FOP) with 3
> tables (one for each category) and within each table put the values that
> have that category.  So something like this:
> 
> Cat 1
> valA valB
> 
> Cat 2
> valC valD
> valG valH
> 
> Cat 3
> valE valF
> 
> I have managed to do simple foreach, but I can't seem to find a way of
> doing this using the "category" attribute to group items.
> 
> One thing that could be an issue here, is that I don't have any control
> of the "category" attribute value, so it isn't possible to hardcode the
> XSL file to pull out specific values by attribute value.  In other words
> this needs to be 100% dynamic, as on 1 run the XML may have 2 categories
> and 6 products, on another it may have 40 categories and 500 products.
> 
> Regards
> Manuel Reyes
> 
>  
> 
> 
> 
>  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

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.