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 (JIRA)" <xa...@xml.apache.org> on 2010/01/12 18:27:54 UTC

[jira] Created: (XALANJ-2513) TransformerException: NullPointerException with Java 1.6 on AIX

TransformerException: NullPointerException with Java 1.6 on AIX
---------------------------------------------------------------

                 Key: XALANJ-2513
                 URL: https://issues.apache.org/jira/browse/XALANJ-2513
             Project: XalanJ2
          Issue Type: Bug
      Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects.  Anybody can view the issue.)
          Components: transformation, Xalan
    Affects Versions: 2.7.1
         Environment: AIX 5.2, IBM SDK Version 6, Xalan-J 2.7.1
            Reporter: Robert Quan


Attempting to use trax to perform a transformation using IBM SDK Java 6 on AIX will result in a TransformerException: java.null.NullPointerException.  If one was to use IBM Java 5, the transformation will run without issue.

The following details the data required to reproduce the issue:

Stylesheet (sort.xsl) - Note that the stylesheet will be precompiled into a translet in a jar called ipteXslTranslets.jar
-----------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
    <!ENTITY nbsp "&#x00A0;"> <!-- NO-BREAK SPACE -->
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <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 &gt; $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() &gt;= $actualRowstart and position() &lt; $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 (0.xml)
------------------------------
<div>
<BR/><table xmlns:java="http://xml.apache.org/xslt/java" class="summary" cellSpacing="0" width="400" border="0">
<tr>
<td>Elapsed Time (hh:mm:ss): 00:01:20</td>
</tr>
<tr>
<td>VLAN 530</td>
</tr>
</table><table xmlns:java="http://xml.apache.org/xslt/java" class="formatted" width="600">
<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.026</td><td class="rowDataRight">32</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.014</td><td class="rowDataRight">16</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.023</td><td class="rowDataRight">40</td>
</tr>
</tbody>
</table>
</div>

Source Code (XsltTest.java)
--------------------------------------
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;

/**
 *
 * @author dmalykhanov
 */
public class XsltTest {

    private TransformerFactory tf;

    //static {
    //    System.setProperty(
    //        "javax.xml.transform.TransformerFactory",
    //        "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"
    //    );
    //}

    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;
    }
}

Shell script used to run transformation
----------------------------------------------------
#!/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:  ipteXslTranslets.jar contains the precompiled stylesheet sort.xsl
** Note:  Commenting out the directive to reassign the TransformerFactory to trax.TransformerFactoryImpl will not generate the exception and the transformation will work

Command line command to run the transformation
----------------------------------------------------------------------
$ run.sh 0.xml sort

** Note: 0.xml contains the input xml as provided above
** Note: sort is the precompiled translet class for the stylesheet provided above




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Resolved: (XALANJ-2513) TransformerException: NullPointerException with Java 1.6 on AIX

Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XALANJ-2513?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henry Zongaro resolved XALANJ-2513.
-----------------------------------

    Resolution: Invalid

Resolving as invalid, as it's caused by using a combination of classes from the Java run-time environment and the user's class path that is incompatible.

> TransformerException: NullPointerException with Java 1.6 on AIX
> ---------------------------------------------------------------
>
>                 Key: XALANJ-2513
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2513
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects.  Anybody can view the issue.) 
>          Components: transformation, Xalan
>    Affects Versions: 2.7.1
>         Environment: AIX 5.2, IBM SDK Version 6, Xalan-J 2.7.1
>            Reporter: Robert Quan
>
> Attempting to use trax to perform a transformation using IBM SDK Java 6 on AIX will result in a TransformerException: java.null.NullPointerException.  If one was to use IBM Java 5, the transformation will run without issue.
> The following details the data required to reproduce the issue:
> Stylesheet (sort.xsl) - Note that the stylesheet will be precompiled into a translet in a jar called ipteXslTranslets.jar
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE xsl:stylesheet [
>     <!ENTITY nbsp "&#x00A0;"> <!-- NO-BREAK SPACE -->
> ]>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>     <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 &gt; $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() &gt;= $actualRowstart and position() &lt; $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 (0.xml)
> ------------------------------
> <div>
> <BR/><table xmlns:java="http://xml.apache.org/xslt/java" class="summary" cellSpacing="0" width="400" border="0">
> <tr>
> <td>Elapsed Time (hh:mm:ss): 00:01:20</td>
> </tr>
> <tr>
> <td>VLAN 530</td>
> </tr>
> </table><table xmlns:java="http://xml.apache.org/xslt/java" class="formatted" width="600">
> <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.026</td><td class="rowDataRight">32</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.014</td><td class="rowDataRight">16</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.023</td><td class="rowDataRight">40</td>
> </tr>
> </tbody>
> </table>
> </div>
> Source Code (XsltTest.java)
> --------------------------------------
> 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;
> /**
>  *
>  * @author dmalykhanov
>  */
> public class XsltTest {
>     private TransformerFactory tf;
>     //static {
>     //    System.setProperty(
>     //        "javax.xml.transform.TransformerFactory",
>     //        "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"
>     //    );
>     //}
>     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;
>     }
> }
> Shell script used to run transformation
> ----------------------------------------------------
> #!/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:  ipteXslTranslets.jar contains the precompiled stylesheet sort.xsl
> ** Note:  Commenting out the directive to reassign the TransformerFactory to trax.TransformerFactoryImpl will not generate the exception and the transformation will work
> Command line command to run the transformation
> ----------------------------------------------------------------------
> $ run.sh 0.xml sort
> ** Note: 0.xml contains the input xml as provided above
> ** Note: sort is the precompiled translet class for the stylesheet provided above

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2513) TransformerException: NullPointerException with Java 1.6 on AIX

Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XALANJ-2513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12799357#action_12799357 ] 

Henry Zongaro commented on XALANJ-2513:
---------------------------------------

Sorry - I probably should have realized what was going on sooner.  IBM's Java 1.4.2 and Java 5.0 includes code derived from the Xalan-J interpreter and XSLTC, with some additional bug fixes and some other IBM-specific features.  For historical reasons, all this is included in the IBM Java run-time environment with package names unchanged from the Apache versions of the code.

IBM's Java 6.0 no longer includes XSLTC, but instead includes a proprietary XSLT compiler.  Code derived from the Xalan-J interpreter is still part of IBM's Java 6.0.  So when you include XSLTC on your class path with IBM's Java 6.0, you end up with XSLTC picking up some classes from the boot class path (those that are included with the Java run-time) and others from your own class path.  The versions of the classes are incompatible, and you end up with a NullPointerException.

This has been a long-standing problem with overriding a version of an XSLT processor that's included with the Java run-time.  The way to work around it is to use the Endorsed Standards Override Mechanism to use your xalan.jar, serializer.jar, xml-apis.jar and xercesImpl.jar in preference to the version of the JAXP implementation that's included with your Java run-time.  See [1] for more information.

I hope that helps.

[1] http://xml.apache.org/xalan-j/faq.html#faq-N100EF

> TransformerException: NullPointerException with Java 1.6 on AIX
> ---------------------------------------------------------------
>
>                 Key: XALANJ-2513
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2513
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects.  Anybody can view the issue.) 
>          Components: transformation, Xalan
>    Affects Versions: 2.7.1
>         Environment: AIX 5.2, IBM SDK Version 6, Xalan-J 2.7.1
>            Reporter: Robert Quan
>
> Attempting to use trax to perform a transformation using IBM SDK Java 6 on AIX will result in a TransformerException: java.null.NullPointerException.  If one was to use IBM Java 5, the transformation will run without issue.
> The following details the data required to reproduce the issue:
> Stylesheet (sort.xsl) - Note that the stylesheet will be precompiled into a translet in a jar called ipteXslTranslets.jar
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE xsl:stylesheet [
>     <!ENTITY nbsp "&#x00A0;"> <!-- NO-BREAK SPACE -->
> ]>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>     <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 &gt; $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() &gt;= $actualRowstart and position() &lt; $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 (0.xml)
> ------------------------------
> <div>
> <BR/><table xmlns:java="http://xml.apache.org/xslt/java" class="summary" cellSpacing="0" width="400" border="0">
> <tr>
> <td>Elapsed Time (hh:mm:ss): 00:01:20</td>
> </tr>
> <tr>
> <td>VLAN 530</td>
> </tr>
> </table><table xmlns:java="http://xml.apache.org/xslt/java" class="formatted" width="600">
> <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.026</td><td class="rowDataRight">32</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.014</td><td class="rowDataRight">16</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.023</td><td class="rowDataRight">40</td>
> </tr>
> </tbody>
> </table>
> </div>
> Source Code (XsltTest.java)
> --------------------------------------
> 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;
> /**
>  *
>  * @author dmalykhanov
>  */
> public class XsltTest {
>     private TransformerFactory tf;
>     //static {
>     //    System.setProperty(
>     //        "javax.xml.transform.TransformerFactory",
>     //        "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"
>     //    );
>     //}
>     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;
>     }
> }
> Shell script used to run transformation
> ----------------------------------------------------
> #!/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:  ipteXslTranslets.jar contains the precompiled stylesheet sort.xsl
> ** Note:  Commenting out the directive to reassign the TransformerFactory to trax.TransformerFactoryImpl will not generate the exception and the transformation will work
> Command line command to run the transformation
> ----------------------------------------------------------------------
> $ run.sh 0.xml sort
> ** Note: 0.xml contains the input xml as provided above
> ** Note: sort is the precompiled translet class for the stylesheet provided above

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org