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

Re: Why does the addition of one (1) to a positiveInte

Subject: Re: Why does the addition of one (1) to a positiveInteger produce an integer?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 29 Aug 2010 16:43:48 -0400
Re:  Why does the addition of one (1) to a positiveInte
At 2010-08-29 15:43 -0400, Costello, Roger L. wrote:
I have a function that has a parameter with a xs:positiveInteger datatype. Within the function I add one (1) to the parameter:

<xsl:function name="f:iter">
    <xsl:param name="count" as="xs:positiveInteger" />

...

<xsl:sequence select="f:iter($count + 1)" />

</xsl:function>

When I run this I get an error, "The argument to f:iter is xs:positiveInteger, the supplied value is xs:integer"

What is the rationale for this? After all, if I add one (1) to any positiveInteger the result must be a positiveInteger.

False. An integer *type* is more general than the positiveInteger *type*, thus when you add the two the result is the more general of the two, which is integer. And since the integer is too general for the parameter type, there is the error.


So, not only do you need:

<xsl:sequence select="f:iter($count + xs:positiveInteger(1))" />

.... but wherever you are calling f:iter() for the first time, if you are doing:

<xsl:value-of select="f:iter(3)"/>

.... you will get the same problem and you need to say:

<xsl:value-of select="f:iter(xs:positiveInteger(3))"/>

I hope this helps.

. . . . . . . . . . Ken

--
XSLT/XQuery training:   after http://XMLPrague.cz 2011-03-28/04-01
Vote for your XML training:   http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

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.