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

CSV data in attribute - how to get unique values?

Subject: CSV data in attribute - how to get unique values?
From: vesse <vessep@xxxxxxxxx>
Date: Thu, 30 Dec 2010 11:25:03 +0800
 CSV data in attribute - how to get unique values?
Hi,

I have an XML document that looks roughly like this:
<root>
  <toplevel attrib="123">
     <midlevel attrib="453,123">
        <bottomlevel attrib="853,123" name="MyName"/>
        <bottomlevel name="OtherItem"/>

I need to group the bottomlevel items under each unique attribute ID.
Attribute on the lowest level found is the one that's important (
(ancestor-or-self::/@attrib)[last()] ). So in the above example the
output would be

Attrib:853
- MyName

Attrib: 123
- MyName
- OtherItem

Attrib: 453
- OtherItem

In the old days the attribute value was not CSV data so I used

<xsl:key name="attribs" match="*" use="@attrib"/>
<xsl:for-each select="*[generate-id()=generate-id(key('attribs', @attrib)[1])]">

to go through the items by the attribute values. This does not of
course produce the wanted output anymore. Is it anyway possible to get
the unique values from the CSV data to work with, and then be also
able to find the bottomlevel items that have the current ID? I'm using
XSLT 1.0 (transformation done in browser). Changing the XML file
structure is out of the question.


BR,
Vesse

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.