[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Expanding Ranges


Subject: Re: [xsl] Expanding Ranges
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Fri, 20 Mar 2009 21:38:07 +0530

On Fri, Mar 20, 2009 at 12:13 PM, Ganesh Babu N <nbabuganesh@xxxxxxxxx>
wrote:
> <xsl:variable name="start"
> select="number(substring-after(cr[1]/@refid,'MEPRfig'))"/>
> <xsl:variable name="end"
> select="number(substring-after(cr[last()]/@refid,'MEPRfig'))"/>
> <xsl:value-of select="for $i in $start to $end return concat('fig', $i)"/>
>
> These are my expressions.
>
> It shows the following error as:
>
> B XPTY0004: Required item type of first operand of 'to' is xs:integer;
> supplied value has
> B item type xs:double.
>
> How to resolve this. the values are 2 and 3.

The return type of function 'number' is, xs:double (ref:
http://www.w3.org/TR/xpath-functions/#func-number).

To use an expression like, for $i in $start to $end -- $start and $end
must be xs:integer 's at runtime.

you can use something like, xs:integer(substring-after ... (ref:
http://www.w3.org/TR/xpath20/#id-constructor-functions).


--
Regards,
Mukul Gandhi


Current Thread