- From: Kay, Michael <Michael.Kay@softwareag.com>
- Date: Thu, 5 Jun 2003 11:30:45 +0200
- To: "Kay, Michael" <Michael.Kay@softwareag.com>, "'Ellis Cohen'" <e.cohen@acm.org>, public-qt-comments@w3.org
> > Use: Since <xsl:copy-of> can now be used to copy a sequence
> > of items, it would be excellent if one could write
> >
> > <xsl:copy-of select="foo[1 to 4]"/>
> >
> > instead of the more long-winded
> >
> > <xsl:for-each select="1 to 4">
> > <xsl:copy-of select="foo[.]"/>
> > </xsl:for-each>
> >
I should also have mentioned that your example is incorrect. "." within a
predicate applied to a node-set always selects a node, so its effective
boolean value is true.
You meant to write:
<xsl:for-each select="1 to 4">
<xsl:variable name="n" select="."/>
<xsl:copy-of select="foo[$n]"/>
</xsl:for-each>
But of course you can also do this as:
<xsl:copy-of select="foo[position() < 5]"/>
or you can use the subsequence() function if you prefer.
Michael Kay
Received on Thursday, 5 June 2003 05:30:50 UTC