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(_at_)ntlworld(_dot_)com]
Sent: Monday, June 30, 2003 6:00 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com; Schwartz, Rechell R, ALABS
Subject: Re: [xsl] 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