xsl-list
[Top] [All Lists]

[xsl] passing element to function having an 'xs:anyAtomicType?' parameter

2008-02-23 08:55:10

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
        

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>