Re: [xsl] Expanding Ranges

Subject: Re: [xsl] Expanding Ranges
From: Ganesh Babu N <nbabuganesh@xxxxxxxxx>
Date: Fri, 20 Mar 2009 12:13:24 +0530
Thanks rawath,

I will try. I am getting another error. when i getting the number
using the substring-after

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

Regards,
Ganesh


On Fri, Mar 20, 2009 at 11:47 AM, Joga Singh Rawat
<jrawat@xxxxxxxxxxxxxx> wrote:
> You can try it by matching <cr> with condition <xsl:if
> test="following::text()='-'"> !!!
>
> -----Original Message-----
> From: Ganesh Babu N [mailto:nbabuganesh@xxxxxxxxx]
> Sent: Friday, March 20, 2009 11:17 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Expanding Ranges
>
> Agreed,
>
> <p>some text <cross-ref><cr refid="MEPRtbl1">1</cr> and <cr
> refid="MEPRtbl2">2</cr>-<cr refid="MEPRtbl4">4</cr></cross-ref>
> some text</p>
>
> If the input is like above the child position will change to 2 and 3.
> How to get the values which are around "-".
>
> Regards,
> Ganesh.
>
> On Fri, Mar 20, 2009 at 11:10 AM, Joga Singh Rawat <jrawat@xxxxxxxxxxxxxx>
> wrote:
>> As per your input it is the child of cross-ref and seperated by -,
>> which shows that there must be two child if the data consist -.
>>
>> -----Original Message-----
>> From: Ganesh Babu N [mailto:nbabuganesh@xxxxxxxxx]
>> Sent: Friday, March 20, 2009 10:33 AM
>> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>> Subject: Re: [xsl] Expanding Ranges
>>
>> for the sample it is fine. But actually it may come in any child position.
>> we cannot fix the position as first and second.
>>
>> Regards,
>> Ganesh
>>
>>
>> On Fri, Mar 20, 2009 at 10:00 AM, Joga Singh Rawat
>> <jrawat@xxxxxxxxxxxxxx>
>> wrote:
>>> You can match cross-ref and get the value of first child and second
>>> child as a value of $start and $end respectively.
>>>
>>>
>>> Thanks for the code. But how to get $start and $end when "-" is there
>>> between tags.

Current Thread