I got a situation where i need to sort the xml elements in a snapshot and group them based on a section and subsection code. I can actually sort and group them, but i need to display a section and subsection heading only for the first element in that particular group. At the moment the section heading is displaying for all the elements.
Subject:XSL Grouping Author:Tony Lavinio Date:31 Jul 2009 09:13 AM
Without seeing your code, it's hard to give advice, but:
Using the preceding-sibling:: axis, you can tell whether your
element is the first of a group or not, by comparing the name
of the previous element to the current element.
Subject:XSL Grouping Author:Tony Lavinio Date:10 Aug 2009 10:55 AM
General-purpose XSLT questions are best asked on XSL-LIST run
by Mulberry Technologies.
But not seeing the input file makes it hard to see where your
transform is going wrong (you've shown us part of your transform,
a sample of good results and a sample of bad results) but the
pieces we need to see include the input.
<Composition><Para>Imidacloprid 100 g/L, moxidectin 10 g/L.</Para><Para>For further information see Advocate for Cats, Section 15(b)(ii).</Para></Composition>
</IVS></File>
</PublicationSnapshot>
Subject:XSL Grouping Author:Tony Lavinio Date:11 Aug 2009 10:17 AM
We're looking at it, but note that empty namespace bindings are
illegal in XML. You cannot have xmlns="" or xmlns:cals="" and
expect the stylesheet to work.
Subject:XSL Grouping Author:Tony Lavinio Date:11 Aug 2009 10:26 AM
You can use the preceding-sibling:: axis to check to see if this
is the first reference to that section. Save a copy of the
current value in a variable, and then do something like this: