At 2009-03-21 11:37 +0530, Mukul Gandhi wrote:
>> <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.
I'm not sure why you say this.
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.
But production [3] for ExprSingle points to the RangeExpr through
productions [8], [9], [10] then [11].
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" />
That seems awkward when the following works:
T:\ftemp>type mukul.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:variable name="start" select="3"/>
<xsl:variable name="end" select="5"/>
<xsl:value-of select="for $i in $start to $end return concat('fig',$i)"/>
</xsl:template>
</xsl:stylesheet>
T:\ftemp>xslt2 mukul.xsl mukul.xsl
fig3 fig4 fig5
T:\ftemp>
I hope this helps.
. . . . . . . . . Ken
--
XSLT/XSL-FO/XQuery training in Los Angeles (New dates!) 2009-06-08
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
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>
--~--