Subject: Re: [xsl] Find the next item in a sequence From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sun, 3 May 2020 17:14:41 -0000 |
Yes, you would need to define a variable containing all the tokens (same as you would in xsl:for-each). Alternatively you could "look-behind" by setting an extra parameter $previous as you move through the list. Michael Kay Saxonica > On 3 May 2020, at 16:51, Rick Quatro rick@xxxxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > > Hi All, > > This is related to my previous question about a line-break algorithm. In my tokenized list, I want to "look-ahead" to the next member of the list. I tried .[position()+1] but this doesn't work. Do I need to set the tokenize($input) to a variable first? Thank you. > > Rick > > <xsl:iterate select="tokenize($input)"> > <xsl:param name="line-length" select="0"/> > <xsl:param name="break-count" select="$break-count"/> > <xsl:message select="."/> > <xsl:message select="position()=last()"/> > <xsl:choose> > <xsl:when test="$line-length gt $break-count"> > <break/> > <xsl:value-of select="concat(.,if(position()!=last()) then ' ' else '')"/> > <xsl:next-iteration> > <xsl:with-param name="line-length" select="string-length(.) + 1"/> > <xsl:with-param name="break-count" select="$break-count - 5"/> > </xsl:next-iteration> > </xsl:when> > <xsl:otherwise> > <xsl:value-of select="concat(.,if(position()!=last()) then ' ' else '')"/> > <xsl:next-iteration> > <xsl:with-param name="line-length" select="$line-length + string-length(.) + 1"/> > <xsl:with-param name="break-count" select="$break-count"/> > </xsl:next-iteration> > </xsl:otherwise> > </xsl:choose> > </xsl:iterate> > XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> > EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/293509> (by email <>)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Find the next item in a seque, Rick Quatro rick@xxx | Thread | Re: [xsl] Find the next item in a s, Rick Quatro rick@xxx |
[xsl] Find the next item in a seque, Rick Quatro rick@xxx | Date | Re: [xsl] Find the next item in a s, Rick Quatro rick@xxx |
Month |