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

Re: Expanding Ranges

Subject: Re: Expanding Ranges
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Sat, 21 Mar 2009 11:37:04 +0530
Re:  Expanding Ranges
On Sat, Mar 21, 2009 at 10:53 AM, Ganesh Babu N <nbabuganesh@xxxxxxxxx> wrote:
> Thanks Mukul,
>
> I got the solution.

I find it surprising if the solution I proposed works as it is.

>> <xsl:value-of select="for $i in $start to $end return concat('fig', $i)"/>

I suspect if this will give the desired result.

If you see the grammar for a "for expression"
(http://www.w3.org/TR/xpath20/#id-for-expressions),

it doesn't allow something like, $x to $y (with the semantics of a
range. xsl:for-each allows this).

Saxon (ver, 9.1.0.2J) compiles the above for expression {for $i in
$start to $end return concat('fig', $i)} fine, but gives a blank
output. It seems, it considers _$start to $end_ as ExprSingle (ref:
http://www.w3.org/TR/xpath20/#doc-xpath-ExprSingle). It seems to me,
Saxon should give an error or a warning in this case.

I feel you should use the following code, instead:

<xsl:variable name="str" as="xs:string*">
    <xsl:for-each select="$start to $end">
       <xsl:value-of select="concat('fig', .)" />
    </xsl:for-each>
</xsl:variable>

<xsl:value-of select="$str" />


-- 
Regards,
Mukul Gandhi

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.