[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:analyze-string explanation needed
> Looking at it, I see the general form as: > > Compare the string to the regular expression. > If there is a match, output something. > If there is no match, output something else. Nope. Compare the string to the regular expression. find _each_ (non-overlapping) substring that matches the regexp. this gives you a sequence of substrings that alternate matching,non-matching,matching,.. for each item in this sequence, execute the matching or non-matching branch of the code. so... > Given the input "3 minutes 57 seconds", ([0-9]+ minutes) matches just once so you get the sequence of strings ("3 minutes","57 seconds") so execute xsl:matching-substring with . set to "3 minutes" producing 180 then execute xsl:non-matching-substring> with . set to "57 seconds" producing 0 think of doing a regexp replace of a large text and changing all "white" to "black" analyze sequence splitsthe text up to a sequnce of strings, that are alternately "white" or <the stuff betwwen matches>. Your two brances would then output "black" in the matching case and do a copy-of in the non matching case and the end result is all occurrences of white get changed to black. David
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|