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

RE: Grouping using group-starting-with=

Subject: RE: Grouping using group-starting-with=
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 7 Sep 2006 18:13:39 +0100
group starting with
The value of group-starting-with is a pattern that must match a node in the
population. Since the population consists of Item elements, none of them
match the pattern RepresentationTerm[.='Code']. Use

group-starting-with="Item[RepresentationTerm='Code']"

A bit of a gotcha - only this morning I found someone doing select="para"
group-by="para/title". Oh for a context-free language!

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx]
> Sent: 07 September 2006 17:37
> To: XSL List
> Subject:  Grouping using group-starting-with=
>
> Hi folks,
>
> 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.
>
> It would seem that the following does not work:
>
>      <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.
>
> Thanks!
>
> . . . . . . . . . . Ken
>
>
> 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:output indent="yes"/>
>
> <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>
>
> </xsl:stylesheet>
>
> t:\ftemp>call xslt2 test.xml test.xsl test.out
>
> 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

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.