Re: for vs. for-each
| Newsgroups | gmane.text.xml.xsl.general.mulberrytech |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 2021-03-14 at 20:09 +0000, Wendell Piez [email protected] wrote: > Hi, > > Another way to gloss this is that while "$values[.]" doesn't have the > intended effect, > > <xsl:for-each select="1 to count($values)"> > <xsl:variable name="p" select="."/> > <xsl:sequence select="$values[$p]"/> > </xsl:for-each> > > Oughta work just fine. I've often wished for, <xsl:for-each select="1to 20" at="pos"> as a short-cut for <xsl:variable as="xs:integer" select="position()" /> by analogy with XQuery, for $i at $pos in $sequence return ... But then, i tnd to try writing group by in XPath expressions too :) Liam -- Liam Quin, https://www.delightfulcomputing.com/ Available for XML/Document/Information Architecture/XSLT/ XSL/XQuery/Web/Text Processing/A11Y training, work & consulting. Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org --~---------------------------------------------------------------- XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/3329386 or by email: [email protected] --~--