[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. No, it's better described as: divide the string into a sequence of strings some of which match the regex and others which don't. Then process all the substrings in turn, appling the matching-string instruction to the matching substrings and the non-matching-substring instruction to the others. Try: <xsl:variable name="duration" as="xs:dayTimeDuration" select="xs:dayTimeDuration(concat('PT', translate(replace($in, ' ([ms])[a-z]+ ', '$1'), 'ms ', 'MS')))"/> <xsl:variable name="seconds" as="xs:integer" select="$duration div xs:dayTimeDuration('PT1S')"/> Michael Kay http://www.saxonica.com/
|
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
|