[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
On 6/12/06, Phillip B Oldham <phillip.oldham@xxxxxxxxxx> wrote:
That's fine.
Oh. That makes it more long winded.
Re: [xsl] Listing keywords
Subject: Re: [xsl] Listing keywords From: "andrew welch" <andrew.j.welch@xxxxxxxxx> Date: Mon, 12 Jun 2006 11:43:55 +0100 |
On 6/12/06, Phillip B Oldham <phillip.oldham@xxxxxxxxxx> wrote:
Hi all
I'm trying to get my head around the following problem... I've got a doc with the following structure:
<item> <keywords>Chair, Sofa, Cabinet</keywords> </item> <item> <keywords>Chair, Sofa</keywords> </item> <item> <keywords>Cabinet</keywords> </item> <item> <keywords>Chair</keywords> </item>
What I need to get out of that is a list of unique keywords, eg:
<keyword>Cabinet</keyword> <keyword>Chair</keyword> <keyword>Sofa</keyword>
That's fine.
Anyone know how I can do this? I'm using XSL/XPath 1.0.
Oh. That makes it more long winded.
I would do this in two stages - the first is to create a nodeset of words by processing each <keywords> element using a recursive named template to get something like:
<word>Chair</word> <word>Sofa</word>
Once you have stage 1 complete, use the node-set extension function of your processor to turn the result-tree-fragment into a nodeset, then use grouping to do a distinct on the values.
Splitting a string: http://www.dpawson.co.uk/xsl/sect2/N7240.html#d9590e343
Grouping: http://sources.redhat.com/ml/xsl-list/2000-07/msg00458.html
cheers andrew
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Listing keywords, Michael Kay | Thread | [xsl] Re: Schematron with XPath 2.0, David Sewell |
Re: [xsl] Listing keywords, David Carlisle | Date | RE: [xsl] Listing keywords, Michael Kay |
Month |