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

RE: Jumping out a loop

Subject: RE: Jumping out a loop
From: Meltem Kogelbauer <meltem.kogelbauer@xxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Apr 2001 11:27:49 +0100
jumping font
I have dealt with similar cases as the following.
You cannot jump out of for-each rule. Once you are in you are in. 
If you want to apply style-A, say, for the first two children and style-B
for the rest you can use two for-each loop selecting first two and the rest.

If you want to apply style-C for two children positioned as, say, the third
and the sixth children among the others, then best way would be applying a
template to the children

<xsl:template match="children">
<!--Children is grasslands in this case I believe-->

	<whatever-style><xsl:value-of select="." /></whatever-style>
</xsl:template>

When you call the template, call with the specific names

<xsl:apply-templates select="//Grasslands[LinksForTheGenus]" />
<xsl:apply-templates select="//Grasslands[References]" />

This way you can add/delete children easily.

Hope this will help.

Meltem





-----Original Message-----
From: Tanzila Mohammad [mailto:tmohammad@xxxxxxxxxxxxxxxxxxxx]
Sent: 18 April 2001 11:03 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Jumping out a loop


I have the following loop:

<xsl:for-each select="Grasslands/*[position()&gt;3 and text()]">
	<h3><font color="#00007f"><i><xsl:value-of
select="name()"/></i></font></h3>
	<p><font color="#008000"><xsl:value-of select="."/></font></p>
</xsl:for-each>

I want to jump out the loop at two children and perform a different function
for them:
For the Links of Genus child:

 <h3><a NAME="Label0045"></a><font color="#00007F"><i>Links for the
genus:</i></font></h3>
      <ul>
     <xsl:for-each select="Grasslands/LinksForTheGenus/Link">
      <li><font color="#008000"> <xsl:value-of
select="Address"/>;&#xA;<xsl:value-of select="Name"/> </font></li>
      </xsl:for-each>
      </ul>

For The References child:
 <h3><a NAME="Label0045"></a><font
color="#00007F"><i>References:</i></font></h3>

     <xsl:for-each select="Grasslands/References/Ref">
      <font color="#008000"> <xsl:value-of select="Name"/>&#xA;
<xsl:value-of select="Year"/>;&#xA;</font>
      </xsl:for-each>


References and Links for Genus are slightly different than all children of
Grasslands, I figure I need some sort of 'if' statement maybe:

<xsl:if test="Grasslands[LinksForTheGenus]"> do process
<xsl:if test="Grasslands[References]"> do process

Any suggestions.

Tanz


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.