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

Re: apply templates to the nth record and above?

Subject: Re: apply templates to the nth record and above?
From: "cutlass" <cutlass@xxxxxxxxxxx>
Date: Wed, 6 Mar 2002 13:18:42 -0000
select nth record
just do a test with position()


xsl
-----------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:template match="root">


<xsl:apply-templates select="AREA[position() &gt; 1]" />

 </xsl:template>

 <xsl:template match="AREA">
 <xsl:value-of select="."/>
 </xsl:template>
</xsl:stylesheet>

xml
----------------------------

<?xml version="1.0" ?>
<root>
<AREA>1</AREA>

<AREA>2</AREA>

<AREA>2</AREA>

<AREA>3</AREA>

<AREA>4</AREA>
</root>

HTH, jim fuller
----- Original Message -----
From: "Lea Allison" <Lea.Allison@xxxxxxxxxxxxxx>
To: "XSL List (E-mail)" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, March 06, 2002 1:08 PM
Subject:  apply templates to the nth record and above?


> Hi
>
> can anyone tell me how I can apply a templates to a record starting above
1
> and continue for the rest of the set?
>
> Here's what I got, it only does record 2, but I need record 2 and above.
>
> <xsl:apply-templates select="AREA[2] | following-sibling::AREA"
> mode="within"/>
>
>
> If anyones interested, heres what Im working on, perhaps there is a better
> way? Its an XSL to create a multiple row HTML table where the first row
may
> be extended with rowspan.
>
>
> <xsl:template match="CONTACTS/CONTACT">
>
> <TR valign="top">
> <TD>
> <xsl:attribute name="rowspan"><xsl:value-of
> select="count(AREA)" /></xsl:attribute>
> <xsl:value-of select="COUNTRY" /></TD><xsl:apply-templates
> select="AREA[1]" />
> </TR>
>
> <xsl:apply-templates select="AREA[2] | following-sibling::AREA"
> mode="within"/>
>
> </xsl:template>
>
> <xsl:template match="AREA">
>
> <TD><xsl:apply-templates /></TD><TD><xsl:value-of select="@phone"
> /></TD>
> </xsl:template>
>
> <xsl:template match="AREA" mode="within">
>
> <TR>
> <TD><xsl:apply-templates /></TD><TD><xsl:value-of
> select="@phone" /></TD>
> </TR>
> </xsl:template>
>
>
>
>
> Thanks
>
> Lea
>
>  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.