[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl:analyze-string explanation needed

Subject: RE: xsl:analyze-string explanation needed
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 20 Jul 2006 16:02:25 +0100
xsl analyze string if condition
> 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. 


<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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.