This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Breaking a string into repeated elements
- From: Dimitre Novatchev <dnovatchev at yahoo dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Fri, 7 Jun 2002 13:09:56 -0700 (PDT)
- Subject: [xsl] Re: Breaking a string into repeated elements
- Reply-to: xsl-list at lists dot mulberrytech dot com
> The construct in question looks like this:
>
> <ListOfItems>10, 20, 30, 31</ListOfItems>
>
> and I want to make it look like this:
>
> <ListOfItems howMany="4">
> <Item>10</Item>
> <Item>20</Item>
> <Item>30</Item>
> <Item>31</Item>
> </ListOfItems>
>
> Note that the existing <ListOfItems> may be delimited by either
> spaces, commas, or commas and spaces.
>
> I figure that I need to use some combination of substring() and some
> other string functions, but am unsure of where to start.
This is a quite FAQ. The short answer is that you can do this easily
with the FXSL library. Example code that solves exactly this type of
problem can be found at:
http://sources.redhat.com/ml/xsl-list/2002-05/msg01295.html
or
http://sources.redhat.com/ml/xsl-list/2002-04/msg01350.html
Cheers,
Dimitre Novatchev.
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list