Java Null pointer exception thrown in XSLTransform
--------------------------------------------------
Key: XALANJ-2038
URL: http://issues.apache.org/jira/browse/XALANJ-2038
Project: XalanJ2
Type: Bug
Components: Xalan
Versions: 2.6
Environment: P 4.0 Windows XP pro
Reporter: Win
When using an XSLTransformer class to transform xml data, NullPointEXception is
thrown for xsl for the following data and xsl files. The test can be run as:
\j2sdk1.4.2_05\bin\java.exe -classpath
.;.\lib\xml-apis.jar;.\lib\xercesImpl.jar;.\lib\xalan.jar
org.apache.xalan.xslt.Process -in data.xml -xsl transform.xsl -out a1.html
(It will through a null pointer exception when called from the java api
XSLTransfomer.transform as well). These same file will transform correctly with
other tools such as XMLSpy or Microsoft's
Here are the data.xml and transform.xsl files:
data.xml::
==========
<?xml version="1.0" encoding="UTF-8"?>
<processErrors reportDate="2005/01/10" reportTime="11:36:10"
partnerName="TechData" lifecycleInstanceName="Lifecycle 2925870"
lifecycleDefinitionName="850POTo856ShipNotice">
<processError lifecycleexceptionid="6e04b6142d0375d70a80759722d891dca1fc64e0"
errorDate="2004/09/01" errorTime="05:54:00" errorLevel="document" new="1"
documentName="Purchase Order (850)"
standardName="X12" specificationName="PO850"><error type="Timing Rule Failure"
description="Process 'Lifecycle 2925870', document type '850': '0001',
TimingRule 'complete coverage of 850 by 856 (part number) within 24 hours':
Start Date/Time was null" />
<error type="Complete Coverage Unmatched Value" description="Process 'Lifecycle
2925870', document type '850': '0001', CompleteCoverageRule
'850POTo856ShipNoticeCC2-PR': The '850' had values '[00001, 00002]', that were
never matched by any observed, related documents." />
</processError>
</processErrors>
transform.xsl::
===============
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<!-- summary -->
<xsl:template name="reportSummary">
<xsl:param name="processErrors"/>
<table border="0" cellpadding="3" cellspacing="0" width="670">
<tr>
<td colspan="2" style="background-color: #02669a;
font-family:verdana, sans-serif; font-size: 11px; font-weight: bold; color:
#ffffff; border:#999999 1px solid;">Process Error Summary</td>
</tr>
<tr>
<td width="35%" style="background-color: #bcd3e9;
font-family:verdana, sans-serif; font-size: 10px; color: #000000;
border-left:#999999 1px solid; border-bottom:#999999 1px solid;">Date/Time</td>
<td width="65%" style="font-family:verdana, sans-serif;
font-size: 10px; color: #000000; border-left:#999999 1px solid;
border-right:#999999 1px solid;border-bottom:#999999 1px solid;">
<xsl:value-of
select="$processErrors/@reportDate"/>
<xsl:text> </xsl:text>
<xsl:value-of
select="$processErrors/@reportTime"/>
<xsl:text> CST</xsl:text>
</td>
</tr>
<tr>
<td width="35%" style="background-color: #bcd3e9;
font-family:verdana, sans-serif; font-size: 10px; color: #000000;
border-left:#999999 1px solid; border-bottom:#999999 1px solid;">Total
Errors</td>
<td width="65%"
style="font-family:verdana, sans-serif; font-size: 10px; color: #000000;
border-left:#999999 1px solid; border-right:#999999 1px
solid;border-bottom:#999999 1px solid;">
<!--xsl:value-of
select="count($processErrors/processError/@new)"/-->
<xsl:value-of
select="count($processErrors/processError/@new)"/>
</td>
</tr>
</table>
</xsl:template>
<!-- /summary -->
<!-- main testReport.xsl -->
<xsl:template match="*">
<table border="0" cellspacing="0" cellpadding="0"
width="100%">
<tr>
<td>
<table border="0" cellpadding="10"
cellspacing="0" width="100%">
<tr>
<td valign="top">
<div id="ProcessSummaryReport">
<a id="reportTop" name="reportTop"></a>
<xsl:call-template name="reportSummary">
<xsl:with-param name="processErrors"
select="//processErrors" />
</xsl:call-template>
</div>
<br/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]