xsl-list
[Top] [All Lists]

Re: [xsl] Expanding Ranges

2009-03-20 12:08:35
On Fri, Mar 20, 2009 at 12:13 PM, Ganesh Babu N 
<nbabuganesh(_at_)gmail(_dot_)com> 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:

 XPTY0004: Required item type of first operand of 'to' is xs:integer;
supplied value has
 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

--~------------------------------------------------------------------
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>