[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] looping over a string?


Subject: [xsl] looping over a string?
From: Eric Scheid <eric.scheid@xxxxxxxxxxxxxxx>
Date: Mon, 23 Jan 2006 21:46:36 +1100

Is there some way I could loop over each character of a variable containing
the string "ABC[...]XYZ", passing that in as a parameter to a template, and
using that to select the appropriate node (or output 'none' if there are no
matching rows)?

Or is this the entirely wrong approach? (loops stink of procedural
processing)

I have xml data that looks like this:

<results>
<row>
    <letter>A</letter>
    <authors>22</authors>
    <articles>34</articles>
</row>
<!-- repeat for letters A to Z, but some might be missing -->
</results>

I want to generate this:

A: 22, 34
B: 32, 98
C: none
D: 5,6
... etc

e.


Current Thread
Keywords
xml