Subject: [xsl] Grouping using group-starting-with= From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 07 Sep 2006 12:37:01 -0400 |
I'm using Saxon 8.8J and I'm trying to group a bunch of sibling items into groups of items that start with the item that has a particular child with a particular value.
<xsl:for-each-group select="/*/Item" group-starting-with="RepresentationTerm[.='Code']">
Looking at XSLT 2.0, group-starting-with= requires the population to all be nodes, and there are a number of nodes that match the pattern test supplied ... yet running the example I am only getting a single group ... which I suspect is just the first node in the population.
I'm missing something obvious ... could someone please point me to the correct chapter and verse?
I have my example below of test data and stylesheet ... my real data has much more information and more representation terms, but it should still be the same.
t:\ftemp>type test.xml <?xml version="1.0" encoding="utf-8"?> <Model file="UBL-qDT-2.0"> <Item> <DictionaryEntryName>Allowance Charge Reason_ Code. Type</DictionaryEntryName> <RepresentationTerm>Code</RepresentationTerm> </Item> <Item> <DictionaryEntryName>Allowance Charge Reason_ Code. Content</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Allowance Charge Reason_ Code List. Identifier</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Allowance Charge Reason_ Language. Identifier</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Channel_ Code. Type</DictionaryEntryName> <RepresentationTerm>Code</RepresentationTerm> </Item> <Item> <DictionaryEntryName>Channel_ Code. Content</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Channel_ Code List. Identifier</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Channel_ Language. Identifier</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Chip_ Code. Type</DictionaryEntryName> <RepresentationTerm>Code</RepresentationTerm> </Item> <Item> <DictionaryEntryName>Chip_ Code. Content</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Chip_ Code List. Identifier</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Chip_ Language. Identifier</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Country Identification_ Code. Type</DictionaryEntryName> <RepresentationTerm>Code</RepresentationTerm> </Item> <Item> <DictionaryEntryName>Country Identification_ Code. Content</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Country Identification_ Code List. Identifier</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Country Identification_ Language. Identifier</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Currency_ Code. Type</DictionaryEntryName> <RepresentationTerm>Code</RepresentationTerm> </Item> <Item> <DictionaryEntryName>Currency_ Code. Content</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Currency_ Code List. Identifier</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Currency_ Language. Identifier</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Document Status_ Code. Type</DictionaryEntryName> <RepresentationTerm>Code</RepresentationTerm> </Item> <Item> <DictionaryEntryName>Document Status_ Code. Content</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Document Status_ Code List. Identifier</DictionaryEntryName> </Item> <Item> <DictionaryEntryName>Document Status_ Language. Identifier</DictionaryEntryName> </Item> </Model> t:\ftemp>type test.xsl <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="/"> <All> <xsl:for-each-group select="/*/Item" group-starting-with="RepresentationTerm[.='Code']"> <Identification> <xsl:value-of select="DictionaryEntryName"/> </Identification> </xsl:for-each-group> </All> </xsl:template>
t:\ftemp>type test.out <?xml version="1.0" encoding="UTF-8"?> <All> <Identification>Allowance Charge Reason_ Code. Type</Identification> </All>
-- UBL/XML/XSLT/XSL-FO training: Verx, Denmark 2006-10-02/06,11-20/24 UBL International 2006 2006-11-13/17 http://www.ublconference.com World-wide corporate, govt. & user group UBL, XSL, & XML training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Manipulating values from , David Carlisle | Thread | RE: [xsl] Grouping using group-star, Michael Kay |
Re: [xsl] Creating child elements t, Cherry Yang | Date | Re: [xsl] blank page formatting, Danny Vint |
Month |