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

XSLT: Restructuring/Grouping

Subject: XSLT: Restructuring/Grouping
From: Wolfgang May <may@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 4 Mar 2000 19:45:39 +0100 (MET)
xsl follow ref

I want to "group" elements by one of their attributes, e.g.,

<org id="org-WEU">
   <name>Western European Union</name>
    <member type="member" ref="Greece"/>
    <member type="member" ref="France"/>
    <member type="member" ref="Spain"/>
    <member type="member" ref="Germany"/>
    <member type="member" ref="Italy"/>
    <member type="member" ref="Belgium"/>
    <member type="member" ref="Luxembourg"/>
    <member type="member" ref="Netherlands"/>
    <member type="member" ref="Portugal"/>
    <member type="member" ref="United-Kingdom"/>
    <member type="associate member" ref="Turkey"/>
    <member type="associate member" ref="Norway"/>
    <member type="associate member" ref="Iceland"/>
    <member type="observer" ref="Austria"/>
    <member type="observer" ref="Denmark"/>
    <member type="observer" ref="Finland"/>
    <member type="observer" ref="Sweden"/>
    <member type="observer" ref="Ireland"/>
    <member type="associate partner" ref="Czech-Republic"/>
    <member type="associate partner" ref="Hungary"/>
    <member type="associate partner" ref="Slovakia"/>
    <member type="associate partner" ref="Latvia"/>
    <member type="associate partner" ref="Lithuania"/>
    <member type="associate partner" ref="Poland"/>
    <member type="associate partner" ref="Bulgaria"/>
    <member type="associate partner" ref="Romania"/>
    <member type="associate partner" ref="Estonia"/>


<org id="org-WEU">
   <name>Western European Union</name>
    <member type="member" 
            countries="Greece France Spain Germany Italy Belgium 
                       Luxembourg Netherlands Portugal
    <member type="associate member" 
            countries="Turkey Norway Iceland"/>
    <member type="observer" 
            countries="Austria Denmark Finland Sweden Ireland"/>
    <member type="associate partner" 
            countries="Czech-Republic Hungary Slovakia Latvia
                       Lithuania Poland Bulgaria Romania

A "solution" based on

<xsl:template match="org">
    <xsl:copy-of select="@id|name|abbrev"/>
    <xsl:for-each select="member/@type"> 
            ... collect all members of that type ... 

does *not* work since duplicates in [[member/@type]] are not removed.
The solution must not assume that the domain where the type value is
taken from is known when writing the program - thus the values must be
selected from the input file.

... I am missing a possibility to define views in XSLT which are not
output but can be used in the computation. 


to avoid questions: That's not my homework.

-- -----------------------------------------------------------------
Wolfgang May             E-mail: may@xxxxxxxxxxxxxxxxxxxxxxxxxx   
Universitaet Freiburg    http://www.informatik.uni-freiburg.de/~may/
Institut fuer Informatik D-79110 Freiburg / Germany
Lehrstuhl fuer Datenbanken und Informationssysteme
Tel ++49 761 203-8131    Fax ++49 761 203-8122 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


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.
First Name
Last Name
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.