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

RE: Different Colors for Alternating Rows

Subject: RE: Different Colors for Alternating Rows
From: "Schwartz, Rechell R, ALABS" <rrschwartz@xxxxxxx>
Date: Tue, 1 Jul 2003 07:35:45 -0500
name of different colors
Kevin,

This time I didn't get the error and the performance was excellent (only
about 6 seconds), BUT every row came out with the oddStyle. Any clue
what is wrong?

Thanks,
Rechell

-----Original Message-----
From: Kevin Jones [mailto:kjjones@xxxxxxxxxxxx] 
Sent: Monday, June 30, 2003 6:00 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx; Schwartz, Rechell R, ALABS
Subject: Re:  Different Colors for Alternating Rows

On Monday 30 June 2003 21:49, Schwartz, Rechell R, ALABS wrote:
> Kevin,
>
> Thanks for your help. I got the following error, when I tried your
> stylesheet. Does this mean my parser won't support extensions? What
can I
> do about this?
>
> Rechell
>
> ####<Jun 30, 2003 1:05:03 PM EDT> <Info> <GUI> <maeder> <FM>
> <ExecuteThread: '7' for queue: 'default'> <> <> <0 00000>
<data.jsp::XSL
> Transformation Exception:java.lang.NoSuchMethodException: For
extension
> function, could n ot find method
>
weblogic.apache.xerces.dom.DocumentFragmentImpl.node-set([ExpressionCont
ext
>,] ).> ####<Jun 30, 2003 1:05:03 PM EDT> <Info> <GUI> <maeder> <FM>
> <ExecuteThread: '7' for queue: 'default'> <> <> <0 00000>

The EXSLT node-set() function is implemented in later versions of Xalan
but I 
guess you have something older. There is an equivilent function in older

versions called nodeset() which is under a different namespace. I have 
changed the stylesheet to use this. 

There are three changes, if you search on 'xalan' you will find each
one.

Kev.

<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xalan="http://xml.apache.org/xalan"
    extension-element-prefixes="xalan"
    version="1.0">

    <xsl:output method="html" indent="yes"/>

    <xsl:key name='lookup' match='entry' use='@key'/>

    <xsl:variable name='index'>
        <xsl:for-each select='/table/tr[td[not(a or @class)]]'>
            <entry key="{generate-id()}" even="{position() mod 2 = 0}"/>
        </xsl:for-each>
    </xsl:variable>

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

    <xsl:template match="table/tr[td[not(a) and not(@class)]]">
        <xsl:variable name='tr' select='.'/>
        <xsl:for-each select='xalan:nodeset($index)'>
            <xsl:call-template name='copytr'>
                <xsl:with-param name='node' select='$tr'/>
                <xsl:with-param name='inset' select='true()'/>
                <xsl:with-param name='even' 
select='key("lookup",generate-id($tr))/@even'/>
            </xsl:call-template>
        </xsl:for-each>
    </xsl:template>

    <xsl:template name='copytr'>
        <xsl:param name='node' select='.'/>
        <xsl:param name='inset'/>
        <xsl:param name='even'/>

        <xsl:for-each select='$node'>
            <xsl:copy>
                <xsl:choose>
                    <xsl:when test="$inset">
                        <xsl:choose>
                            <xsl:when test="$even=true()">
                                <td class="evenMedium" width="35%">
                                    <xsl:apply-templates 
select="td[1]/node()|td[1]/@*"/>
                                </td>
                                <td class="evenMedium" width="65%">
                                    <xsl:apply-templates 
select="td[2]/node()|td[2]/@*"/>
                                </td>
                            </xsl:when>
                            <xsl:otherwise>
                                <td class="oddMedium" width="35%">
                                    <xsl:apply-templates 
select="td[1]/node()|td[1]/@*"/>
                                </td>
                                <td class="oddMedium" width="65%">
                                    <xsl:apply-templates 
select="td[2]/node()|td[2]/@*"/>
                                </td>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:apply-templates select="node()|@*"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:copy>
        </xsl:for-each>
    </xsl:template>

</xsl:stylesheet>


 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.