Subject: Re: [xsl] Expanding Ranges From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx> Date: Sat, 21 Mar 2009 11:37:04 +0530 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Expanding Ranges, Ganesh Babu N | Thread | Re: [xsl] Expanding Ranges, G. Ken Holman |
Re: [xsl] Expanding Ranges, Ganesh Babu N | Date | Re: [xsl] Empty fo:block legal?, G. Ken Holman |
Month |