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

passing element to function having an 'xs:anyAtomicTyp

Subject: passing element to function having an 'xs:anyAtomicType?' parameter
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Sat, 23 Feb 2008 16:54:36 +0100
 passing element to function having an 'xs:anyAtomicTyp
I am trying to use the function funcx:day-of-week <URL:http://www.xsltfunctions.com/xsl/functx_day-of-week.html> with the following stylesheet:

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="2.0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:functx="http://www.functx.com">

<xsl:output method="text"/>

  <xsl:function name="functx:day-of-week" as="xs:integer?">
    <xsl:param name="date" as="xs:anyAtomicType?"/>

    <xsl:sequence select="
    if (empty($date))
    then ()
    else xs:integer((xs:date($date) - xs:date('1901-01-06'))
            div xs:dayTimeDuration('P1D')) mod 7
   "/>

</xsl:function>

  <xsl:template match="/">
    <xsl:value-of
      select="root/date-list/date/functx:day-of-week(.)"
      separator="&#13;&#10;"/>
  </xsl:template>

</xsl:stylesheet>

and against the following XML sample:

<root>
  <date-list>
    <date>2008-02-18</date>
    <date>2008-02-19</date>
    <date>2008-02-20</date>
    <date>2008-02-21</date>
    <date>2008-02-22</date>
    <date>2008-02-23</date>
    <date>2008-02-24</date>
  </date-list>
</root>

Saxon 9 and Gestalt 1 run the stylesheet without problems, however AltovaXML complains:

Error in XPath 2.0 expression at as
C:\path\sheet.xml
Line 10, Character 29

Type error, value does not match a required type as specified by the matching rules in 2.5.4 SequenceType Matching. - 'xs:anyAtomicType?'


Line 10 is
<xsl:param name="date" as="xs:anyAtomicType?"/>
so, as far as I understand it, Altova complains about passing in an element to the function having an 'xs:anyAtomicType?' parameter.



What do you think, is that a bug in AltovaXML?



--


Martin Honnen

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.