Manuel,
I think this is better suited to the XSL list, which you can find more info on here:
http://xml.apache.org/fop/maillist.html#xslt-mulberry
But it looks like you want something like this:
<xsl:for-each test="/data/products/product"> <xsl:sort select="." order="ascending"/> <xsl:if test="@category!=*/preceding-sibling::*/[EMAIL PROTECTED]"> <fo:block> <xsl:value-of select="@category"/><br/> </fo:block> </xsl:if> <fo:block> <xsl:value-of select="value1"/> <xsl:value-of select="value2"/> <fo:block> </xsl:for-each>
That is rough and untested, but I believe the idea is there.
Good luck!
Web Maestro Clay
On Dec 9, 2003, at 7:23 AM, Manuel Reyes wrote:
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 for FOP to create a PDF 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 merging (i.e. cycling through each "product" in "products", 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
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]