[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Find the next item in a sequence

Subject: Find the next item in a sequence
From: "Rick Quatro rick@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 3 May 2020 15:51:18 -0000
 Find the next item in a sequence
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>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.