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

RE: RE: Alternatives to "Stopping" a for-each

Subject: RE: RE: Alternatives to "Stopping" a for-each
From: <trond.huso@xxxxxx>
Date: Mon, 18 Feb 2013 07:22:35 +0000
RE: RE:  Alternatives to "Stopping" a for-each
Just in case someone else is in the same situation. This became my solution.
Thanks for valuable feedback to Michael and Serhiy.

<xsl:template name="getRanking">
        <xsl:param name="structure"/>
        <xsl:param name="counter"/>
        <xsl:param name="winner"/>

        <xsl:choose>
            <xsl:when test="$structure/Start[Ranking=$counter]/StartNo =
$winner">
                <xsl:value-of
select="$structure/Start[Ranking=$counter]/StartNo"/>
                <!--<xsl:text> </xsl:text>-->
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of
select="$structure/Start[Ranking=$counter]/StartNo"/>
                <xsl:text>-</xsl:text>
                <xsl:call-template name="getRanking">
                    <xsl:with-param name="structure" select="$structure"/>
                    <xsl:with-param name="counter" select="$counter + 1"/>
                    <xsl:with-param name="winner" select="$winner"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

Called like this:

<xsl:for-each select="Legs[@ResultsComplete='true']/Leg">

                    <xsl:value-of select="LegNo" />
                    <xsl:text>. avd: </xsl:text>

                    <xsl:call-template name="getRanking">
                        <xsl:with-param name="structure" select="Starts" />
                        <xsl:with-param name="counter" select="1" />
                        <xsl:with-param name="winner"
select="Winners/Winner/@StartNo" />

                    </xsl:call-template>

....
</xsl:for-each>


Trond

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.