xsl-list
[Top] [All Lists]

[xsl] CSV data in attribute - how to get unique values?

2010-12-29 21:25:14
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] CSV data in attribute - how to get unique values?, vesse <=