xsl-list
[Top] [All Lists]

Re: [xsl] Help to construct a loop

2007-12-29 14:09:46
Hi Henry,

Without seeing your source and how your $myString is formed, this is rather hard to answer. Nor have you told us what XSLT version you have. In XSLT 1.0, dissecting a string is done using a recursive template ("saving" to a variable is not possible in XSLT). In XSLT 2.0, dissecting a string is much easier, i.e. by using tokenize(), replace() or xsl:analyze-string. Some XSLT 1.0 processors however allow the use of the EXSLT extensions, see http://exslt.org for how to use them.

Note that XSLT is a declarative language which makes "traditional" approaches (while loop, assigning to a variable) not possible. If the string you've put into $myString comes from nodes (elements, attributes etc), it is probably easier to construct the output you want during the process, instead of after the $myString construction (in fact, constructing how the output should look like is all you do with XSLT, in general).

Cheers,
-- Abel Braaksma


henry human wrote:
Hi I will to build a loop (for-each or while, etc)
  I have a long string saved in a variable myString:
    myString= foo ffd : ppp ttt foo : 3mmm foo

  In this sample there are three substrings separated
by a colon token
  How could it be done, looking over the myString in a
loop and f. i.
 save the substring in a variable named buf1  until
all three substrings
 has been read  ?
  I will be very glad for any hint
  Regards
  Henry


      Heute schon einen Blick in die Zukunft von E-Mails wagen? Versuchen Sie´s 
mit dem neuen Yahoo! Mail. www.yahoo.de/mail

--~------------------------------------------------------------------
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>
--~--




--~------------------------------------------------------------------
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>