This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Random indexing into a comma seperated list


> I have a tag in deep in my XML that holds a comma (or space or
> semicolon ...) separated list of tokens:
>
> <tag>1,2,$19.95,4,five</tag>
>
> I have pulled this tag into a variable Tag:
>
> <xsl:variable name="List" select="?path to Tag?"/>
>
> With another node elsewhere in the hierarchy as the context
> node, I need to iterate n times indexing into $List.

Tackle this in two stages. First parse the comma-separated list and
construct a tree in which each value is a separate node. Then use standard
XSLT techniques to process this tree.

(You can do the first stage using the "tokenize" extension in Saxon, if you
don't like writing recursive templates)

Mike Kay
Software AG
>


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]