Subject: RE: [xsl] XPath 2.0 Datatypes namespace From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Fri, 4 Aug 2006 12:21:39 +0100 |
> 1. According to http://www.w3.org/TR/xpath-datamodel/ > xs:dayTimeDuration is a type defined in the > http://www.w3.org/2001/XMLSchema namespace. Why, then, can I > only get this to work in the http://www.w3.org/2005/xpath-datatypes > namespace when using Saxon 8? The W3C made the decision to put these names in the XML schema namespace on 22 Feb 2006, and I implemented the decision in the next release of Saxon, which was version 8.7.1 released on 13 April 2006. Please try to keep up with the latest releases - I know there are better things to do than installing new versions all the time, but you will otherwise get tripped up by small changes like this. > > 2. Why do I need to declare the datatype atall given that the > function is expecting a dayTime Duration datatype, ie why can't > I just use: > > <xsl:sequence > select="adjust-time-to-timezone(xs:time('10:00:00-04:00'), > PT4H)"/> ? PT4H is a path expression, it's short for child::PT4H, and will return an empty sequence unless you have an element of that name. Perhaps you meant to write 'PT4H'. The answer there is that XSLT 2.0 has moved towards stronger type checking. To put the case for this in a nutshell, it means you have to be a bit more explicit in your code about the data types you are using, and in return you get better diagnostics when you make mistakes (like leaving out quotation marks), and therefore easier debugging. > > 3. Am I unwise to be using this functionality until these > standards become recommendations? > For many people the gain from exploiting the new features exceeds the pain caused by the occasional change in the specification. There have been very few changes over the last 2 years that would stop existing code working except in obscure edge cases (this change of namespaces is one of the biggest. Saxon still supports the old namespace in new releases, but of course it doesn't support the new namespace in old releases.) But of course, only you can do the risk assessment for your own project. Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XPath 2.0 Datatypes names, Colin Paul Adams | Thread | RE: [xsl] XPath 2.0 Datatypes names, tom tom |
Re: [xsl] XPath 2.0 Datatypes names, Colin Paul Adams | Date | RE: [xsl] Xpath and Ranges, David White |
Month |