|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Date Difference
"Haarman, Michael" wrote:
> This statement:
> <xsl:variable name="later"
> select="dateStandard[2]"
> as="xs:date"/>
> seemed to work fine, but this one later:
> <xsl:variable name="regexE"
> select="fn:replace($earlierPadded,
> '(.*)/(.*)/(.*)',
> '$3-$1-$2')
> as="xs:date"/>
> threw an error when the value of $regexE was used in the
> later arithmetic, complaining that it was still a string.
> Stating it in the following manner corrected the error:
> <xsl:variable name="regexE"
> select="xs:date(fn:replace($earlierPadded,
> '(.*)/(.*)/(.*)',
> '$3-$1-$2'))"/>
> I suspect I am missing an implicit cast somewhere that
> makes the first statement work and renders the as=
> attribute moot.
The value of the '@as' don't imply a conversion.
Because you didn't use SA processor (or at least not their
SA functionalities), '$eaerlierPadded' is still an
'untypedAtomic'. So it's converted to the expected type
(because it's an 'untypedAtomic') in the first example.
In the second example, it's converted too, but to an
'xs:string', because it's the expected type of the first
argument of the 3-args 'fn:replace()'. The result type of
this function is an 'xs:string'. So it's not converted to
the expected type (because it's not an 'untypedAtomic').
http://www.w3.org/TR/xslt20/#variables
http://www.w3.org/TR/xslt20/#dt-function-conversion-rules
http://www.w3.org/TR/xpath20/#id-function-calls
--drkm
___________________________________________________________________________
Nouveau : tiliphonez moins cher avec Yahoo! Messenger ! Dicouvez les tarifs exceptionnels pour appeler la France et l'international.
Tilichargez sur http://fr.messenger.yahoo.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
|

Cart








