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

Filtering Problem using position()

Subject: Filtering Problem using position()
From: "Schwartz, Rechell R, ALCAS" <rrschwartz@xxxxxxx>
Date: Fri, 8 Nov 2002 11:48:11 -0500
xsl filter position
All,

I am having a filtering problem using the position() function (I am
still new to XSLT, so please bear with me). I am outputting an HTML
table from one XSLT stylesheet, and using it as input to another. The
second stylesheet uses the identity transformation to filter out only
certain rows on which to apply styling elements. The stylesheet indeed
applies the styling only to those elements that I request it to.
However, the styling is based on odd and even rows in the stylesheet,and
it seems that it is applying the calculation of the position() to
INCLUDE those rows that I had excluded when I did a template match.  Any
help would be appreciated.

Following is the stylesheet that applies the styling:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version="1.0">
<xsl:output method="html" indent="yes"/>

<xsl:template match="node()|@*"> <!--identity transform-->
   <xsl:copy>
     <xsl:apply-templates select="node()|@*"/>
   </xsl:copy>
</xsl:template>


<xsl:template match="table[2]/tr[td[not(a)  and not(@class)]]">
      <xsl:copy>
   <xsl:choose>
   <xsl:when test="position() mod 2 = 0">
   <xsl:for-each select="td">
    <td class="evenRowStyle">
     <xsl:apply-templates select="node()|@*"/>
     </td>
    </xsl:for-each>
   </xsl:when>
   <xsl:otherwise>
   <xsl:for-each select="td">
     <td class="oddRowStyle">
     <xsl:apply-templates select="node()|@*"/>
     </td>
    </xsl:for-each>
   </xsl:otherwise>
   </xsl:choose>
     </xsl:copy>
</xsl:template>


</xsl:stylesheet>

Rechell 

 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.