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

RE: conditional html

Subject: RE: conditional html
From: Paul Knepper <pknepper@xxxxxxxxxxxxx>
Date: Tue, 7 May 2002 15:37:15 -0700
conditional html
Wow!

I'm new to this stuff so this really threw me for a loop.

It took me a while to figure out what was going on but now I see the power
of XPath.

Can anyone recommend some good books that will help/teach cool tricks like
this?

Thanks a lot,
Paul


-----Original Message-----
From: Sadasivakurup, Jiji L. [mailto:Jiji_Sadasivakurup@xxxxxxxxxxxxx]
Sent: Tuesday, May 07, 2002 12:04 PM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: RE:  conditional html


This worked for me. 

<xsl:template match="whatever" > 
	<xsl:apply-templates select="somenode[position() mod 6 = 1]"
mode="row" />
</xsl:template>

<xsl:template match="somenode" mode="row" > 
	<tr> 
		<xsl:apply-templates  select=". |
following-sibling::somenode[position() &lt; 6]"  mode="column"  /> 
	</tr>
</xsl:template> 


<xsl:template match="somenode" mode="column" > 
	<td> 
		Matched
	</tr>
</xsl:template> 


-----Original Message-----
From: Paul Knepper [mailto:pknepper@xxxxxxxxxxxxx]
Sent: Tuesday, May 07, 2002 2:50 PM
To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
Subject:  conditional html


How can I insert conditional html?  I want to iterate over a set of nodes
("rows" in the example below) and format a table row for every sixth item.

I tried the following, but of course its an unbalanced xml file:


<xsl:for-each select="rows">
  <xsl:if test="(position() mod 6) = 1">
    <tr>
  </xsl:if>

  <xsl:value-of select="someNode"/>

  <xsl:if test="(position() mod 6) = 0">
    </tr>
  </xsl:if>
</xsl:for-each>

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

 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.