You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Robert Quan <mo...@yahoo.com> on 2010/01/12 03:07:07 UTC
NullPointerException with Java 1.6 on AIX
I have a problem with executing a simple transformation using a translet on AIX 5.2 with JAVA 1.6; it throws the following exception:
JAXP: find factoryId=javax.xml.transform.TransformerFactory
JAXP: found system property, value=org.apache.xalan.xsltc.trax.TransformerFactoryImpl
JAXP: created new instance of class org.apache.xalan.xsltc.trax.TransformerFactoryImpl using ClassLoader: sun.misc.Launcher$AppClassLoader@fca0fca
ERROR: ''
ERROR: 'java.lang.NullPointerException'
Exception in thread "main" javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: java.lang.NullPointerException
at org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:642)
at org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:303)
at test.xslt.XsltTest.run(XsltTest.java:27)
at test.xslt.XsltTest.main(XsltTest.java:20)
Caused by: javax.xml.transform.TransformerException: java.lang.NullPointerException
at org.apache.xalan.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:486)
at org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:632)
... 3 more
Caused by: java.lang.NullPointerException
at org.apache.xml.dtm.ref.sax2dtm.SAX2DTM2.getNodeNameX(Unknown Source)
at org.apache.xml.dtm.ref.DTMDefaultBase.declareNamespaceInContext(Unknown Source)
at org.apache.xml.dtm.ref.sax2dtm.SAX2DTM2.addNode(Unknown Source)
at org.apache.xml.dtm.ref.sax2dtm.SAX2DTM2.startElement(Unknown Source)
at org.apache.xalan.xsltc.dom.SAXImpl.startElement(SAXImpl.java:919)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xalan.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:389)
at org.apache.xalan.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:230)
at org.apache.xalan.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:464)
... 4 more
The source code for the transformation is as follows:
package test.xslt;
import java.io.File;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.Templates;
public class XsltTest {
private TransformerFactory tf;
public static void main(String... args) throws Exception {
XsltTest app = new XsltTest();
System.exit(app.run(args));
}
private int run(String[] args) throws Exception {
tf = TransformerFactory.newInstance();
tf.setAttribute("use-classpath", Boolean.TRUE);
Transformer xslp = tf.newTransformer(new StreamSource(args[1]));
xslp.transform(new StreamSource(new File(args[0])), new StreamResult(System.out));
return 0;
}
}
The script used to execute the transformation is as follows:
#!/bin/sh
CLASSPATH='.:/spirent/metro/5.000/IPTE/ipte/WEB-INF/lib/ipteXslTranslets.jar:afs/hekimian.com/cm-cots/ALL-OS/xalan-j/2.7.1-CM1/xalan.jar:/afs/hekimian.com/cm-cots/ALL-OS/xalan-j/2.7.1-CM1/serializer.jar:/afs/hekimian.com/cm-cots/ALL-OS/xalan-j/2.7.1-CM1/xercesImpl.jar:/afs/hekimian.com/cm-cots/ALL-OS/xalan-j/2.7.1-CM1/xml-apis.jar:'
export CLASSPATH
exec /spirent/cots/java/1.6/jre/bin/java \
-Djaxp.debug=1 \
-Djavax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl\
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl \
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl \
test.xslt.XsltTest "$@"
Note that if I run the code against Java 1.5, it runs fine. However, running with Java 1.6 (on AIX) throws the exception mentioned above.
Please advise and thank you,
Robert
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: NullPointerException with Java 1.6 on AIX
Posted by Robert Quan <mo...@yahoo.com>.
Last try with the node .
< xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
________________________________
From: Henry Zongaro <zo...@ca.ibm.com>
To: xalan-dev@xml.apache.org
Sent: Tue, January 12, 2010 8:56:51 AM
Subject: Re: NullPointerException with Java 1.6 on AIX
Hi, Robert.
Robert Quan <mo...@yahoo.com> wrote on
01/11/2010 09:07:07 PM:
> I have a problem with executing a simple transformation using a
> translet on AIX 5.2 with JAVA 1.6; it throws the following exception:
Thanks for providing the Java source
code for the transformation. I suspect that you will have to provide
a stylesheet and input document that are needed to reproduce the problem.
I would encourage you to report this
as a bug in Jira.[1]
Thanks,
Henry
[1] https://issues.apache.org/jira/browse/XALANJ
------------------------------------------------------------------
Henry Zongaro
XML Transformation & Query Development
IBM Canada Lab T/L 313-6044; Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com
Re: NullPointerException with Java 1.6 on AIX
Posted by Robert Quan <mo...@yahoo.com>.
Seems like the email system literally intreprets the <xsl:stylesheet> node. So here's the missing stylesheet node. I've enclosed it in double quotes so that hopefully it doesn't get intrepreted.
""
________________________________
From: Henry Zongaro <zo...@ca.ibm.com>
To: xalan-dev@xml.apache.org
Sent: Tue, January 12, 2010 8:56:51 AM
Subject: Re: NullPointerException with Java 1.6 on AIX
Hi, Robert.
Robert Quan <mo...@yahoo.com> wrote on
01/11/2010 09:07:07 PM:
> I have a problem with executing a simple transformation using a
> translet on AIX 5.2 with JAVA 1.6; it throws the following exception:
Thanks for providing the Java source
code for the transformation. I suspect that you will have to provide
a stylesheet and input document that are needed to reproduce the problem.
I would encourage you to report this
as a bug in Jira.[1]
Thanks,
Henry
[1] https://issues.apache.org/jira/browse/XALANJ
------------------------------------------------------------------
Henry Zongaro
XML Transformation & Query Development
IBM Canada Lab T/L 313-6044; Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com
Re: NullPointerException with Java 1.6 on AIX
Posted by Robert Quan <mo...@yahoo.com>.
Santiago,
Thanks for the heads up.
Robert
________________________________
From: Santiago Pericas-Geertsen <Sa...@Sun.COM>
To: xalan-dev@xml.apache.org
Sent: Tue, January 12, 2010 2:59:53 PM
Subject: Re: NullPointerException with Java 1.6 on AIX
Robert,
Maybe an issue with e-mail as well, but it appears your input document is missing "<table>".
-- Santiago
On Jan 12, 2010, at 10:18 AM, Robert Quan wrote:
Hi Henry,
>
>Below are the stylesheet and input xml data used. I will put in a bug on Jira as you suggested.
>
>Stylesheet
>----------------
><?xml version="1.0" encoding="UTF-8"?>
><!DOCTYPE xsl:stylesheet [
> <!ENTITY nbsp " "> <!-- NO-BREAK SPACE -->
>]>
>
>
> <xsl:output method="html" indent="yes" />
>
> <xsl:param name="rowstart">1</xsl:param>
> <xsl:param name="rowlimit">20</xsl:param>
> <xsl:param name="sortcolumn">5</xsl:param>
> <xsl:param name="sorttype">number</xsl:param>
> <xsl:param name="sortorder">descending</xsl:param>
>
> <xsl:template match="/">
> <xsl:apply-templates />
> </xsl:template>
>
> <xsl:template match="*/p">
> <xsl:copy-of select="." />
> </xsl:template>
>
> <xsl:template match="*/pre">
> <xsl:copy-of select="." />
> </xsl:template>
>
> <xsl:template match='*/table[@class="summary"]'>
> <xsl:copy-of select="." />
> </xsl:template>
>
> <xsl:template name="getActualRowstart">
> <xsl:param name="totalrows" />
> <xsl:choose>
> <xsl:when test="0 = $totalrows">
> <xsl:text>0</xsl:text>
> </xsl:when>
> <xsl:when test="$rowstart > $totalrows">
> <xsl:value-of select="(floor(($totalrows - 1) div $rowlimit) * $rowlimit) + 1"/>
> </xsl:when>
> <xsl:otherwise>
> <xsl:value-of select="$rowstart"/>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
>
> <xsl:template match='*/table[@class="formatted"]'>
> <xsl:variable name="totalrows"><xsl:value-of select="count(tbody/tr)" /></xsl:variable>
> <xsl:variable name="actualRowstart">
> <xsl:call-template name="getActualRowstart">
> <xsl:with-param name="totalrows" select="$totalrows"/>
> </xsl:call-template>
> </xsl:variable>
> <xsl:copy>
> <xsl:copy-of select="@*" />
> <xsl:apply-templates />
> </xsl:copy>
> <div class="table-metadata" style="display: none;">
> <span class="table-metadata-total-rows"><xsl:value-of select="$totalrows" /></span>
> </div>
> <div class="table-metadata" style="display: none;">
> <span class="table-metadata-row-start"><xsl:value-of select="$actualRowstart" /></span>
> </div>
> </xsl:template>
>
> <xsl:template match="thead|tfoot">
> <xsl:copy-of select="." />
> </xsl:template>
>
> <xsl:template match="tbody">
> <xsl:variable name="totalrows"><xsl:value-of select="count(tr)" /></xsl:variable>
> <xsl:variable name="actualRowstart">
> <xsl:call-template name="getActualRowstart">
> <xsl:with-param name="totalrows" select="$totalrows"/>
> </xsl:call-template>
> </xsl:variable>
> <tbody>
> <xsl:for-each select="tr">
> <xsl:sort select="td[position() = $sortcolumn]" order="{$sortorder}" data-type="{$sorttype}" />
> <xsl:if test="position() >= $actualRowstart and position() < $actualRowstart + $rowlimit">
> <xsl:element name="tr">
> <xsl:choose>
> <xsl:when test="position() mod 2 = 1">
> <xsl:attribute name="class">shaded</xsl:attribute>
> </xsl:when>
> </xsl:choose>
> <xsl:copy-of select="*" />
> </xsl:element>
> </xsl:if>
> </xsl:for-each>
> </tbody>
> </xsl:template>
>
></xsl:stylesheet>
>
>
>Input XML Data
>----------------------
><div>
>
>
><tr>
><td>Elapsed Time (hh:mm:ss): 00:00:10</td>
></tr>
><tr>
><td>VLAN 530</td>
></tr>
>
><thead>
><th class="columnHeader sortAsText" width="16%">Address</th><th class="columnHeader sortAsNumbers" width="12%"><a href="" onclick="return(top.graphSingleTimestampResults('graphName=top-talk-grph|desc=SmartSight Top Talkers by MAC for VLAN 530|cir=10000|dir=|dataSetIndex=1|count=3|label1=0011.434E.8044|value1=0.0|label2=0012.F01A.ED76|value2=0.0|label3=0003.FEAB.6C23|value3=0.0|deviceId=2'));">Bit Rate
>(Mbps)</a></th><th class="columnHeader sortAsNumbers" width="12%">Utilization
>(% of CIR)</th><th class="columnHeader sortAsNumbers" width="12%">Pkt Rate (pkts/sec)</th><th class="columnHeader sortAsNumbers" width="12%">Total Bit Count (Mb)</th><th class="columnHeader sortAsNumbers" width="12%">Total Pkt Count</th>
></thead>
><tbody>
><tr class="shaded">
><td class="rowDataLeft">0011.434E.8044</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.433</td><td class="rowDataRight">0.003</td><td class="rowDataRight">4</td>
></tr>
><tr class="">
><td class="rowDataLeft">0012.F01A.ED76</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.200</td><td class="rowDataRight">0.002</td><td class="rowDataRight">2</td>
></tr>
><tr class="shaded">
><td class="rowDataLeft">0003.FEAB.6C23</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.500</td><td class="rowDataRight">0.003</td><td class="rowDataRight">5</td>
></tr>
></tbody>
></table>
></div>
>
>
>
>
________________________________
From: Henry Zongaro <zo...@ca.ibm.com>
>To: xalan-dev@xml.apache.org
>Sent: Tue, January 12, 2010 8:56:51 AM
>Subject: Re: NullPointerException with Java 1.6 on AIX
>
>
>Hi, Robert.
>
>Robert Quan <mo...@yahoo.com> wrote on 01/11/2010 09:07:07 PM:
>> I have a problem with executing a simple transformation using a
>> translet on AIX 5.2 with JAVA 1.6; it throws the following exception:
>
>Thanks for providing the Java source code for the transformation. I suspect that you will have to provide a stylesheet and input document that are needed to reproduce the problem.
>
>I would encourage you to report this as a bug in Jira.[1]
>
>Thanks,
>
>Henry
>[1] https://issues.apache.org/jira/browse/XALANJ
>------------------------------------------------------------------
>Henry Zongaro
>XML Transformation & Query Development
>IBM Canada Lab T/L 313-6044; Phone +1 905 413-6044
>mailto:zongaro@ca.ibm.com
>
>
>
Re: NullPointerException with Java 1.6 on AIX
Posted by Santiago Pericas-Geertsen <Sa...@Sun.COM>.
Robert,
Maybe an issue with e-mail as well, but it appears your input document is missing "<table>".
-- Santiago
On Jan 12, 2010, at 10:18 AM, Robert Quan wrote:
> Hi Henry,
>
> Below are the stylesheet and input xml data used. I will put in a bug on Jira as you suggested.
>
> Stylesheet
> ----------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE xsl:stylesheet [
> <!ENTITY nbsp " "> <!-- NO-BREAK SPACE -->
> ]>
>
>
> <xsl:output method="html" indent="yes" />
>
> <xsl:param name="rowstart">1</xsl:param>
> <xsl:param name="rowlimit">20</xsl:param>
> <xsl:param name="sortcolumn">5</xsl:param>
> <xsl:param name="sorttype">number</xsl:param>
> <xsl:param name="sortorder">descending</xsl:param>
>
> <xsl:template match="/">
> <xsl:apply-templates />
> </xsl:template>
>
> <xsl:template match="*/p">
> <xsl:copy-of select="." />
> </xsl:template>
>
> <xsl:template match="*/pre">
> <xsl:copy-of select="." />
> </xsl:template>
>
> <xsl:template match='*/table[@class="summary"]'>
> <xsl:copy-of select="." />
> </xsl:template>
>
> <xsl:template name="getActualRowstart">
> <xsl:param name="totalrows" />
> <xsl:choose>
> <xsl:when test="0 = $totalrows">
> <xsl:text>0</xsl:text>
> </xsl:when>
> <xsl:when test="$rowstart > $totalrows">
> <xsl:value-of select="(floor(($totalrows - 1) div $rowlimit) * $rowlimit) + 1"/>
> </xsl:when>
> <xsl:otherwise>
> <xsl:value-of select="$rowstart"/>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
>
> <xsl:template match='*/table[@class="formatted"]'>
> <xsl:variable name="totalrows"><xsl:value-of select="count(tbody/tr)" /></xsl:variable>
> <xsl:variable name="actualRowstart">
> <xsl:call-template name="getActualRowstart">
> <xsl:with-param name="totalrows" select="$totalrows"/>
> </xsl:call-template>
> </xsl:variable>
> <xsl:copy>
> <xsl:copy-of select="@*" />
> <xsl:apply-templates />
> </xsl:copy>
> <div class="table-metadata" style="display: none;">
> <span class="table-metadata-total-rows"><xsl:value-of select="$totalrows" /></span>
> </div>
> <div class="table-metadata" style="display: none;">
> <span class="table-metadata-row-start"><xsl:value-of select="$actualRowstart" /></span>
> </div>
> </xsl:template>
>
> <xsl:template match="thead|tfoot">
> <xsl:copy-of select="." />
> </xsl:template>
>
> <xsl:template match="tbody">
> <xsl:variable name="totalrows"><xsl:value-of select="count(tr)" /></xsl:variable>
> <xsl:variable name="actualRowstart">
> <xsl:call-template name="getActualRowstart">
> <xsl:with-param name="totalrows" select="$totalrows"/>
> </xsl:call-template>
> </xsl:variable>
> <tbody>
> <xsl:for-each select="tr">
> <xsl:sort select="td[position() = $sortcolumn]" order="{$sortorder}" data-type="{$sorttype}" />
> <xsl:if test="position() >= $actualRowstart and position() < $actualRowstart + $rowlimit">
> <xsl:element name="tr">
> <xsl:choose>
> <xsl:when test="position() mod 2 = 1">
> <xsl:attribute name="class">shaded</xsl:attribute>
> </xsl:when>
> </xsl:choose>
> <xsl:copy-of select="*" />
> </xsl:element>
> </xsl:if>
> </xsl:for-each>
> </tbody>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> Input XML Data
> ----------------------
> <div>
>
>
> <tr>
> <td>Elapsed Time (hh:mm:ss): 00:00:10</td>
> </tr>
> <tr>
> <td>VLAN 530</td>
> </tr>
>
> <thead>
> <th class="columnHeader sortAsText" width="16%">Address</th><th class="columnHeader sortAsNumbers" width="12%"><a href="" onclick="return(top.graphSingleTimestampResults('graphName=top-talk-grph|desc=SmartSight Top Talkers by MAC for VLAN 530|cir=10000|dir=|dataSetIndex=1|count=3|label1=0011.434E.8044|value1=0.0|label2=0012.F01A.ED76|value2=0.0|label3=0003.FEAB.6C23|value3=0.0|deviceId=2'));">Bit Rate
> (Mbps)</a></th><th class="columnHeader sortAsNumbers" width="12%">Utilization
> (% of CIR)</th><th class="columnHeader sortAsNumbers" width="12%">Pkt Rate (pkts/sec)</th><th class="columnHeader sortAsNumbers" width="12%">Total Bit Count (Mb)</th><th class="columnHeader sortAsNumbers" width="12%">Total Pkt Count</th>
> </thead>
> <tbody>
> <tr class="shaded">
> <td class="rowDataLeft">0011.434E.8044</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.433</td><td class="rowDataRight">0.003</td><td class="rowDataRight">4</td>
> </tr>
> <tr class="">
> <td class="rowDataLeft">0012.F01A.ED76</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.200</td><td class="rowDataRight">0.002</td><td class="rowDataRight">2</td>
> </tr>
> <tr class="shaded">
> <td class="rowDataLeft">0003.FEAB.6C23</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.500</td><td class="rowDataRight">0.003</td><td class="rowDataRight">5</td>
> </tr>
> </tbody>
> </table>
> </div>
>
> From: Henry Zongaro <zo...@ca.ibm.com>
> To: xalan-dev@xml.apache.org
> Sent: Tue, January 12, 2010 8:56:51 AM
> Subject: Re: NullPointerException with Java 1.6 on AIX
>
>
> Hi, Robert.
>
> Robert Quan <mo...@yahoo.com> wrote on 01/11/2010 09:07:07 PM:
> > I have a problem with executing a simple transformation using a
> > translet on AIX 5.2 with JAVA 1.6; it throws the following exception:
>
> Thanks for providing the Java source code for the transformation. I suspect that you will have to provide a stylesheet and input document that are needed to reproduce the problem.
>
> I would encourage you to report this as a bug in Jira.[1]
>
> Thanks,
>
> Henry
> [1] https://issues.apache.org/jira/browse/XALANJ
> ------------------------------------------------------------------
> Henry Zongaro
> XML Transformation & Query Development
> IBM Canada Lab T/L 313-6044; Phone +1 905 413-6044
> mailto:zongaro@ca.ibm.com
>
>
Re: NullPointerException with Java 1.6 on AIX
Posted by Robert Quan <mo...@yahoo.com>.
Hi Henry,
Below are the stylesheet and input xml data used. I will put in a bug on Jira as you suggested.
Stylesheet
----------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " "> <!-- NO-BREAK SPACE -->
]>
<xsl:output method="html" indent="yes" />
<xsl:param name="rowstart">1</xsl:param>
<xsl:param name="rowlimit">20</xsl:param>
<xsl:param name="sortcolumn">5</xsl:param>
<xsl:param name="sorttype">number</xsl:param>
<xsl:param name="sortorder">descending</xsl:param>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="*/p">
<xsl:copy-of select="." />
</xsl:template>
<xsl:template match="*/pre">
<xsl:copy-of select="." />
</xsl:template>
<xsl:template match='*/table[@class="summary"]'>
<xsl:copy-of select="." />
</xsl:template>
<xsl:template name="getActualRowstart">
<xsl:param name="totalrows" />
<xsl:choose>
<xsl:when test="0 = $totalrows">
<xsl:text>0</xsl:text>
</xsl:when>
<xsl:when test="$rowstart > $totalrows">
<xsl:value-of select="(floor(($totalrows - 1) div $rowlimit) * $rowlimit) + 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$rowstart"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match='*/table[@class="formatted"]'>
<xsl:variable name="totalrows"><xsl:value-of select="count(tbody/tr)" /></xsl:variable>
<xsl:variable name="actualRowstart">
<xsl:call-template name="getActualRowstart">
<xsl:with-param name="totalrows" select="$totalrows"/>
</xsl:call-template>
</xsl:variable>
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:copy>
<div class="table-metadata" style="display: none;">
<span class="table-metadata-total-rows"><xsl:value-of select="$totalrows" /></span>
</div>
<div class="table-metadata" style="display: none;">
<span class="table-metadata-row-start"><xsl:value-of select="$actualRowstart" /></span>
</div>
</xsl:template>
<xsl:template match="thead|tfoot">
<xsl:copy-of select="." />
</xsl:template>
<xsl:template match="tbody">
<xsl:variable name="totalrows"><xsl:value-of select="count(tr)" /></xsl:variable>
<xsl:variable name="actualRowstart">
<xsl:call-template name="getActualRowstart">
<xsl:with-param name="totalrows" select="$totalrows"/>
</xsl:call-template>
</xsl:variable>
<tbody>
<xsl:for-each select="tr">
<xsl:sort select="td[position() = $sortcolumn]" order="{$sortorder}" data-type="{$sorttype}" />
<xsl:if test="position() >= $actualRowstart and position() < $actualRowstart + $rowlimit">
<xsl:element name="tr">
<xsl:choose>
<xsl:when test="position() mod 2 = 1">
<xsl:attribute name="class">shaded</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:copy-of select="*" />
</xsl:element>
</xsl:if>
</xsl:for-each>
</tbody>
</xsl:template>
</xsl:stylesheet>
Input XML Data
----------------------
<div>
<tr>
<td>Elapsed Time (hh:mm:ss): 00:00:10</td>
</tr>
<tr>
<td>VLAN 530</td>
</tr>
<thead>
<th class="columnHeader sortAsText" width="16%">Address</th><th class="columnHeader sortAsNumbers" width="12%"><a href="" onclick="return(top.graphSingleTimestampResults('graphName=top-talk-grph|desc=SmartSight Top Talkers by MAC for VLAN 530|cir=10000|dir=|dataSetIndex=1|count=3|label1=0011.434E.8044|value1=0.0|label2=0012.F01A.ED76|value2=0.0|label3=0003.FEAB.6C23|value3=0.0|deviceId=2'));">Bit Rate
(Mbps)</a></th><th class="columnHeader sortAsNumbers" width="12%">Utilization
(% of CIR)</th><th class="columnHeader sortAsNumbers" width="12%">Pkt Rate (pkts/sec)</th><th class="columnHeader sortAsNumbers" width="12%">Total Bit Count (Mb)</th><th class="columnHeader sortAsNumbers" width="12%">Total Pkt Count</th>
</thead>
<tbody>
<tr class="shaded">
<td class="rowDataLeft">0011.434E.8044</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.433</td><td class="rowDataRight">0.003</td><td class="rowDataRight">4</td>
</tr>
<tr class="">
<td class="rowDataLeft">0012.F01A.ED76</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.200</td><td class="rowDataRight">0.002</td><td class="rowDataRight">2</td>
</tr>
<tr class="shaded">
<td class="rowDataLeft">0003.FEAB.6C23</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.500</td><td class="rowDataRight">0.003</td><td class="rowDataRight">5</td>
</tr>
</tbody>
</table>
</div>
________________________________
From: Henry Zongaro <zo...@ca.ibm.com>
To: xalan-dev@xml.apache.org
Sent: Tue, January 12, 2010 8:56:51 AM
Subject: Re: NullPointerException with Java 1.6 on AIX
Hi, Robert.
Robert Quan <mo...@yahoo.com> wrote on
01/11/2010 09:07:07 PM:
> I have a problem with executing a simple transformation using a
> translet on AIX 5.2 with JAVA 1.6; it throws the following exception:
Thanks for providing the Java source
code for the transformation. I suspect that you will have to provide
a stylesheet and input document that are needed to reproduce the problem.
I would encourage you to report this
as a bug in Jira.[1]
Thanks,
Henry
[1] https://issues.apache.org/jira/browse/XALANJ
------------------------------------------------------------------
Henry Zongaro
XML Transformation & Query Development
IBM Canada Lab T/L 313-6044; Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com
Re: NullPointerException with Java 1.6 on AIX
Posted by Robert Quan <mo...@yahoo.com>.
Sorry here's an updated copy of the stylesheet. The previous one I posted was missing the <xsl:stylesheet> node
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " "> <!-- NO-BREAK SPACE -->
]>
<xsl:output method="html" indent="yes" />
<xsl:param name="rowstart">1</xsl:param>
<xsl:param name="rowlimit">20</xsl:param>
<xsl:param name="sortcolumn">5</xsl:param>
<xsl:param name="sorttype">number</xsl:param>
<xsl:param name="sortorder">descending</xsl:param>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="*/p">
<xsl:copy-of select="." />
</xsl:template>
<xsl:template match="*/pre">
<xsl:copy-of select="." />
</xsl:template>
<xsl:template match='*/table[@class="summary"]'>
<xsl:copy-of select="." />
</xsl:template>
<xsl:template name="getActualRowstart">
<xsl:param name="totalrows" />
<xsl:choose>
<xsl:when test="0 = $totalrows">
<xsl:text>0</xsl:text>
</xsl:when>
<xsl:when test="$rowstart > $totalrows">
<xsl:value-of select="(floor(($totalrows - 1) div $rowlimit) * $rowlimit) + 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$rowstart"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match='*/table[@class="formatted"]'>
<xsl:variable name="totalrows"><xsl:value-of select="count(tbody/tr)" /></xsl:variable>
<xsl:variable name="actualRowstart">
<xsl:call-template name="getActualRowstart">
<xsl:with-param name="totalrows" select="$totalrows"/>
</xsl:call-template>
</xsl:variable>
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:copy>
<div class="table-metadata" style="display: none;">
<span class="table-metadata-total-rows"><xsl:value-of select="$totalrows" /></span>
</div>
<div class="table-metadata" style="display: none;">
<span class="table-metadata-row-start"><xsl:value-of select="$actualRowstart" /></span>
</div>
</xsl:template>
<xsl:template match="thead|tfoot">
<xsl:copy-of select="." />
</xsl:template>
<xsl:template match="tbody">
<xsl:variable name="totalrows"><xsl:value-of select="count(tr)" /></xsl:variable>
<xsl:variable name="actualRowstart">
<xsl:call-template name="getActualRowstart">
<xsl:with-param name="totalrows" select="$totalrows"/>
</xsl:call-template>
</xsl:variable>
<tbody>
<xsl:for-each select="tr">
<xsl:sort select="td[position() = $sortcolumn]" order="{$sortorder}" data-type="{$sorttype}" />
<xsl:if test="position() >= $actualRowstart and position() < $actualRowstart + $rowlimit">
<xsl:element name="tr">
<xsl:choose>
<xsl:when test="position() mod 2 = 1">
<xsl:attribute name="class">shaded</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:copy-of select="*" />
</xsl:element>
</xsl:if>
</xsl:for-each>
</tbody>
</xsl:template>
</xsl:stylesheet>
________________________________
From: Henry Zongaro <zo...@ca.ibm.com>
To: xalan-dev@xml.apache.org
Sent: Tue, January 12, 2010 8:56:51 AM
Subject: Re: NullPointerException with Java 1.6 on AIX
Hi, Robert.
Robert Quan <mo...@yahoo.com> wrote on
01/11/2010 09:07:07 PM:
> I have a problem with executing a simple transformation using a
> translet on AIX 5.2 with JAVA 1.6; it throws the following exception:
Thanks for providing the Java source
code for the transformation. I suspect that you will have to provide
a stylesheet and input document that are needed to reproduce the problem.
I would encourage you to report this
as a bug in Jira.[1]
Thanks,
Henry
[1] https://issues.apache.org/jira/browse/XALANJ
------------------------------------------------------------------
Henry Zongaro
XML Transformation & Query Development
IBM Canada Lab T/L 313-6044; Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com
Re: NullPointerException with Java 1.6 on AIX
Posted by Henry Zongaro <zo...@ca.ibm.com>.
Hi, Robert.
Robert Quan <mo...@yahoo.com> wrote on 01/11/2010 09:07:07 PM:
> I have a problem with executing a simple transformation using a
> translet on AIX 5.2 with JAVA 1.6; it throws the following exception:
Thanks for providing the Java source code for the transformation. I
suspect that you will have to provide a stylesheet and input document that
are needed to reproduce the problem.
I would encourage you to report this as a bug in Jira.[1]
Thanks,
Henry
[1] https://issues.apache.org/jira/browse/XALANJ
------------------------------------------------------------------
Henry Zongaro
XML Transformation & Query Development
IBM Canada Lab T/L 313-6044; Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com