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

RE: Date Difference

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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.