Subject: Re: [xsl] RE: FO - How to group and sort in XSL:FO on a sibling values From: Liam R E Quin <liam@xxxxxx> Date: Thu, 13 Dec 2012 13:02:01 -0500 |
On Thu, 2012-12-13 at 11:27 +0000, Chris Booth wrote: > [...] > > I am struggling with Axis on the Xpath and how to group and sort. Search for muenchian grouping. Or, download Saxon and use XSLT 2, which has grouping built in; Michael Kay's "XSLT and XPath 2.0" book has examples, and there are also examples in the XSLT 2 spec on www.w3.org/TR/tr-date-all (don't use the XSLT 3 draft though, it's not ready yet!) > From the XML below, I am looking for a way where I loop over > Lines/Line and based on the value in LineGroup/GroupCode, if it's the > first occurance of that LineGroup/GroupCode then display the > GroupDescription. This is not XML-Enlightened thinking. Which is not to say that it is wrong, but that you will find it easier to work with XSLT, XPath and XL-FO if you shift a little. There are no procedural loops in XSLT. The for-each instruction actually defines a mapping from a sequence of input items to a sequence of output items. Your goal in writing XSLT is to describe the output you want, not how to get there. So, you must think in terms of the desired output and of the input as a tree. The whole tree is available to the XSLT processor. You sent sample XML input but not sample XML output that corresponded to that exact input, just something generic, and I've no idea what you want to appear as "line one data" etc., so can't help more specifically, sorry. Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Co-author: 5th edition of "Beginning XML", Wrox, 2012
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] RE: FO - How to group and, Wendell Piez | Thread | [xsl] XPL file, Mark Wilson |
Re: [xsl] Re: Inserting File Attrib, Nathan Tallman | Date | [no subject], Unknown |
Month |