RE: [xsl] Date Difference

Subject: RE: [xsl] Date Difference
From: drkm <darkman_spam@xxxxxxxx>
Date: Tue, 20 Dec 2005 11:05:26 +0100 (CET)
"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').



Nouveau : tiliphonez moins cher avec Yahoo! Messenger ! Dicouvez les tarifs exceptionnels pour appeler la France et l'international.
Tilichargez sur

Current Thread