You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/07/16 12:14:45 UTC

DO NOT REPLY [Bug 21644] New: - missing data in transform results with translets

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21644>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21644

missing data in transform results with translets

           Summary: missing data in transform results with translets
           Product: XalanJ2
           Version: 2.5
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Xalan
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: longsonr@logica.com


If I take certain xml files and try to extract data from them, some data is not 
matched by the transform. Changing the xml by deleting characters from unused 
attributes of the xml file makes it work so it seems to be something to do with 
the size of the XML input file, hence the unfortunately large size of the 
example data. Using the interpretive processor rather than translets also makes 
it work.

This bug is present in Xalan 2.5.1 and Xalan 2.5.0 but not Xalan 2.4.0.

I am using the Sun JDK 1.4.2 on Windows 2000 with -Xbootclasspath/p:... to 
force the use of the new Xalan/Xerces jars.

In my example showing the fault the report.xml file should be transformed by 
report.xsl into report.html containing BHTHWB \TEST01 in the first table body 
row. In actual fact the pointName is not matched and the output is BHTHWB \. 
This happens consistently. Note that the xml contains two <pointName> nodes and 
the second is matched thus the second row in the output is correct, displaying 
BHTHWB \GAS1AL

To reproduce the problem run the modified SimpleTransform.java program and 
examine the build.html file which is produced. Edit the build.xml file by 
deleting all text between <Outstation> and </Outstation> for instance and the 
pointName appears correctly.

report.xml

<?xml version="1.0" encoding="UTF-8"?>
<ReportData>
  <Outstations>
    <item>
      <DGRiseTime>120</DGRiseTime>
      <IPAddress>0.0.0.0        </IPAddress>
      <IPFailed>false</IPFailed>
      <ODComment>GLENKINDIE WW</ODComment>
      <ODGridReference></ODGridReference>
      <ODName>GLENWW</ODName>
      <OSRiseTime>120</OSRiseTime>
      <PSTNFailed>false</PSTNFailed>
      <PSTNType>2</PSTNType>
      <PSTNTypeText></PSTNTypeText>
      <alarmInhibitTimeout>
        <milliseconds>-3600000</milliseconds>
        <text formatId="0">??-???-???? ??:??:?? ???</text>
      </alarmInhibitTimeout>
      <alarmInhibited>false</alarmInhibited>
      <class>class com.logica.mcweb.dataserver.Outstation</class>
      <comment>W/Gate       </comment>
      <commsFailPriority>2</commsFailPriority>
      <commsState></commsState>
      <controlInhibited>false</controlInhibited>
      <failCount>0</failCount>
      <fixedLinkFailed>false</fixedLinkFailed>
      <id>0</id>
      <lineId>0</lineId>
      <mediaFixed>true</mediaFixed>
      <mediaIP>false</mediaIP>
      <mediaPSTN>false</mediaPSTN>
      <mediaType>Fixed</mediaType>
      <medinaOutstation>true</medinaOutstation>
      <name>BHTHWB     </name>
      <offscan>false</offscan>
      <offscanTimeout>
        <milliseconds>-3600000</milliseconds>
        <text formatId="0">??-???-???? ??:??:?? ???</text>
      </offscanTimeout>
      <outstationAddress>249,30</outstationAddress>
      <outstationType>1</outstationType>
      <outstationTypeText>Unknown</outstationTypeText>
      <phoneNo></phoneNo>
      <pollForEventsOnAlarm>false</pollForEventsOnAlarm>
      <pollForTrendsOnAlarm>false</pollForTrendsOnAlarm>
      <pollOnAlarm></pollOnAlarm>
      <primaryRoute>-1</primaryRoute>
      <replySOHTimeout>0</replySOHTimeout>
      <restoralCode>X</restoralCode>
      <scanSchedule>SCAN_5M </scanSchedule>
      <secondaryRoute>-1</secondaryRoute>
      <sequenceLoadTime>
        <milliseconds>-3600000</milliseconds>
        <text formatId="0">??-???-???? ??:??:?? ???</text>
      </sequenceLoadTime>
      <sequenceLoadUserName>SYSTEM</sequenceLoadUserName>
      <sequenceLoadable>true</sequenceLoadable>
      <sequenceName></sequenceName>
      <setName>SET01    </setName>
      <systemOutstation>false</systemOutstation>
      <timeLastPolled>
        <milliseconds>1058258702000</milliseconds>
        <text formatId="0">15-Jul-2003 09:45:02 BST</text>
      </timeLastPolled>
      <timeLastPoweredUp>
        <milliseconds>-3600000</milliseconds>
        <text formatId="0">??-???-???? ??:??:?? ???</text>
      </timeLastPoweredUp>
      <transient>false</transient>
      <weeklyProfiles></weeklyProfiles>
    </item>
  </Outstations>
  <Points>
    <item>
      <ORLimitText>0</ORLimitText>
      <URLimitText>0</URLimitText>
      <actionCode></actionCode>
      <activeAnnotation></activeAnnotation>
      <alarmInhibitTimeout>
        <milliseconds>-3600000</milliseconds>
        <text formatId="0">??-???-???? ??:??:?? ???</text>
      </alarmInhibitTimeout>
      <alarmPicture>BHTHWB_WR            </alarmPicture>
      <alarmProfileNumber>-1</alarmProfileNumber>
      <alarmStateText></alarmStateText>
      <alarmedByOs>false</alarmedByOs>
      <associatedOutput>false</associatedOutput>
      <checkConformance>0</checkConformance>
      <class>class com.logica.mcweb.dataserver.AnaloguePoint</class>
      <clearTimeDeadband>0</clearTimeDeadband>
      <controlPicture></controlPicture>
      <controlTimeout>0</controlTimeout>
      <currentValue>
        <alarmInhibited>false</alarmInhibited>
        <alarmState>0</alarmState>
        <alarms>0</alarms>
        <class>class com.logica.mcweb.libexp.PointValue</class>
        <controlInhibited>false</controlInhibited>
        <derivation>1</derivation>
        <derivationText>SCHED</derivationText>
        <failed>false</failed>
        <immediateAlarm>false</immediateAlarm>
        <inAlarm>false</inAlarm>
        <intValue>0</intValue>
        <limitState>0</limitState>
        <manual>false</manual>
        <mnemonicId></mnemonicId>
        <offscan>false</offscan>
        <osOffscan>false</osOffscan>
        <outOfRange>false</outOfRange>
        <overRange>false</overRange>
        <poorQuality>false</poorQuality>
        <rawValue>2003</rawValue>
        <rocState>0</rocState>
        <time>
          <milliseconds>1058258702000</milliseconds>
          <text formatId="0">15-Jul-2003 09:45:02 BST</text>
        </time>
        <underRange>false</underRange>
        <valid>true</valid>
        <value>0.3759375</value>
        <valueText>0.37594 mg/L</valueText>
      </currentValue>
      <dataSource></dataSource>
      <deadband>0.0</deadband>
      <deadbandText>0.0</deadbandText>
      <functionComment>Other Data</functionComment>
      <functionName>OTHER</functionName>
      <hiActionCode> </hiActionCode>
      <hiAlarmPriority>7</hiAlarmPriority>
      <hiHiActionCode> </hiHiActionCode>
      <hiHiAlarmPriority>7</hiHiAlarmPriority>
      <hiHiLimitState></hiHiLimitState>
      <hiHiLimitText>0</hiHiLimitText>
      <hiLimitState></hiLimitState>
      <hiLimitText>0</hiLimitText>
      <highestRecordingRate></highestRecordingRate>
      <historicValues></historicValues>
      <loActionCode> </loActionCode>
      <loAlarmPriority>7</loAlarmPriority>
      <loLimitState></loLimitState>
      <loLimitText>0</loLimitText>
      <loLoActionCode> </loLoActionCode>
      <loLoAlarmPriority>7</loLoAlarmPriority>
      <loLoLimitState></loLoLimitState>
      <loLoLimitText>0</loLoLimitText>
      <maxTargetTimeDeadband>0</maxTargetTimeDeadband>
      <maxTargetValue>1000000.0</maxTargetValue>
      <maximumOutputValue>0.0</maximumOutputValue>
      <maximumOutputValueText></maximumOutputValueText>
      <minTargetTimeDeadband>0</minTargetTimeDeadband>
      <minTargetValue>1000000.0</minTargetValue>
      <odComment>CAIRNBORROW WB</odComment>
      <odName>CAIRWB</odName>
      <offscanTimeout>
        <milliseconds>-3600000</milliseconds>
        <text formatId="0">??-???-???? ??:??:?? ???</text>
      </offscanTimeout>
      <outputPointNumber>0</outputPointNumber>
      <outputRawValue1>0</outputRawValue1>
      <outputRawValue2>0</outputRawValue2>
      <outputScaleText></outputScaleText>
      <outputScalingMultiplier>0.0</outputScalingMultiplier>
      <outputScalingOffset>0.0</outputScalingOffset>
      <outstationId>0</outstationId>
      <outstationName>BHTHWB     </outstationName>
      <pointComment>CL2 Inlet Main</pointComment>
      <pointDerivation>0</pointDerivation>
      <pointDerivationCode>R</pointDerivationCode>
      <pointDerivationText>Real</pointDerivationText>
      <pointId>194</pointId>
      <pointName>TEST01</pointName>
      <pointNumber>6</pointNumber>
      <pointReference></pointReference>
      <pointType>1</pointType>
      <pointTypeCode>A</pointTypeCode>
      <pointTypeText>Analogue</pointTypeText>
      <rawValue1>800</rawValue1>
      <rawValue2>4000</rawValue2>
      <recalibrationTag></recalibrationTag>
      <recordingRates></recordingRates>
      <roCActionCode> </roCActionCode>
      <roCAlarmPriority>7</roCAlarmPriority>
      <roCLimitText>0</roCLimitText>
      <scaleText>800=0, 4000=1.00000</scaleText>
      <scalingMultiplier>3.125E-4</scalingMultiplier>
      <scalingOffset>-0.25</scalingOffset>
      <targetDetails>MIN: None MAX: None</targetDetails>
      <targetDuration></targetDuration>
      <targetStatus>-</targetStatus>
      <targetVariance></targetVariance>
      <timeDeadband>0</timeDeadband>
      <unit>
        <class>class com.logica.mcweb.dataserver.Unit</class>
        <id>-1</id>
        <name>mg/L</name>
      </unit>
      <unitId></unitId>
      <zeroThreshold>0.0</zeroThreshold>
      <zeroThresholdText>0</zeroThresholdText>
    </item>
    <item>
      <actionCode>A</actionCode>
      <alarmInhibitTimeout>
        <milliseconds>-3600000</milliseconds>
        <text formatId="0">??-???-???? ??:??:?? ???</text>
      </alarmInhibitTimeout>
      <alarmPicture>BHTHWB_OS            </alarmPicture>
      <alarmPriority>2</alarmPriority>
      <alarmStateText></alarmStateText>
      <alarmedByOs>false</alarmedByOs>
      <associatedOutput>false</associatedOutput>
      <class>class com.logica.mcweb.dataserver.StatusPoint</class>
      <clearTimeDeadband>0</clearTimeDeadband>
      <controlPicture></controlPicture>
      <controlTimeout>0</controlTimeout>
      <currentValue>
        <alarmInhibited>false</alarmInhibited>
        <alarmState>1</alarmState>
        <alarms>0</alarms>
        <class>class com.logica.mcweb.libexp.PointValue</class>
        <controlInhibited>false</controlInhibited>
        <derivation>1</derivation>
        <derivationText>SCHED</derivationText>
        <failed>false</failed>
        <immediateAlarm>false</immediateAlarm>
        <inAlarm>false</inAlarm>
        <intValue>1</intValue>
        <limitState>0</limitState>
        <manual>false</manual>
        <mnemonicId>-1</mnemonicId>
        <offscan>false</offscan>
        <osOffscan>false</osOffscan>
        <outOfRange>false</outOfRange>
        <overRange>false</overRange>
        <poorQuality>false</poorQuality>
        <rawValue>1</rawValue>
        <rocState>0</rocState>
        <time>
          <milliseconds>1058258701000</milliseconds>
          <text formatId="0">15-Jul-2003 09:45:01 BST</text>
        </time>
        <underRange>false</underRange>
        <valid>true</valid>
        <value>1.0</value>
        <valueText>NORMAL</valueText>
      </currentValue>
      <dataSource></dataSource>
      <doubleStatus>false</doubleStatus>
      <functionComment>Leak Detection</functionComment>
      <functionName>UAL</functionName>
      <highestRecordingRate></highestRecordingRate>
      <historicValues></historicValues>
      <mnemonic0>
        <class>class com.logica.mcweb.dataserver.Mnemonic</class>
        <id>-1</id>
        <name>ALARM</name>
      </mnemonic0>
      <mnemonic0State>A</mnemonic0State>
      <mnemonic1>
        <class>class com.logica.mcweb.dataserver.Mnemonic</class>
        <id>-1</id>
        <name>NORMAL</name>
      </mnemonic1>
      <mnemonic1State></mnemonic1State>
      <mnemonic2></mnemonic2>
      <mnemonic2State></mnemonic2State>
      <mnemonic3></mnemonic3>
      <mnemonic3State></mnemonic3State>
      <odComment>CAIRNBORROW WB</odComment>
      <odName>CAIRWB</odName>
      <offStateMnemonic></offStateMnemonic>
      <offscanTimeout>
        <milliseconds>-3600000</milliseconds>
        <text formatId="0">??-???-???? ??:??:?? ???</text>
      </offscanTimeout>
      <onStateMnemonic></onStateMnemonic>
      <outputPoint1>0</outputPoint1>
      <outputPoint2>0</outputPoint2>
      <outstationId>0</outstationId>
      <outstationName>BHTHWB     </outstationName>
      <pointComment>Hydrogen Gas Leak</pointComment>
      <pointDerivation>0</pointDerivation>
      <pointDerivationCode>R</pointDerivationCode>
      <pointDerivationText>Real</pointDerivationText>
      <pointId>1792</pointId>
      <pointName>GAS1AL</pointName>
      <pointNumber>56</pointNumber>
      <pointReference></pointReference>
      <pointType>0</pointType>
      <pointTypeCode>S</pointTypeCode>
      <pointTypeText>Status</pointTypeText>
      <pulseLength>0</pulseLength>
      <recalibrationTag></recalibrationTag>
      <recordingRates></recordingRates>
      <timeDeadband>0</timeDeadband>
    </item>
  </Points>
</ReportData>

report.xsl

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:output indent="yes" method="html" />

    <!-- Start the template matching -->
    <xsl:template match="/">
        <xsl:apply-templates select="ReportData"/>
    </xsl:template>
    
    <xsl:template match="ReportData">
        <xsl:apply-templates select="Points" />
    </xsl:template>
    
    <xsl:template match="Points">
        <table>
       	    <thead>
   	    	<tr>
            	    <th>Column1</th>
		</tr>       	    
       	    </thead>
            <tbody>
                <xsl:apply-templates select="item" />    
            </tbody>
    	</table>
    </xsl:template>

    <xsl:template match="item" >

        <tr>
            <td>
                <xsl:value-of 
select="outstationName" /><xsl:text>\</xsl:text><xsl:value-of 
select="pointName" />
            </td>
        </tr>
    </xsl:template>

    <!-- Must over-ride built-in templates, or we get all sorts of unwanted 
stuff -->
    <xsl:template match="*">
    </xsl:template>

</xsl:stylesheet>

modified SimpleTransform.java from samples directory

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

/**
 *  Use the TraX interface to perform a transformation in the simplest manner 
possible
 *  (3 statements).
 */
public class SimpleTransform
{
	public static void main(String[] args)
    throws TransformerException, TransformerConfigurationException, 
           FileNotFoundException, IOException
  {  

        Properties props = System.getProperties();
        props.put
("javax.xml.transform.TransformerFactory", "org.apache.xalan.xsltc.trax.Transfor
merFactoryImpl");
        System.setProperties(props);

  // Use the static TransformerFactory.newInstance() method to instantiate 
  // a TransformerFactory. The javax.xml.transform.TransformerFactory 
  // system property setting determines the actual class to instantiate --
  // org.apache.xalan.transformer.TransformerImpl.
	TransformerFactory tFactory = TransformerFactory.newInstance();
	
	// Use the TransformerFactory to instantiate a Transformer that will 
work with  
	// the stylesheet you specify. This method call also processes the 
stylesheet
  // into a compiled Templates object.
	Transformer transformer = tFactory.newTransformer(new StreamSource
("report.xsl"));

	// Use the Transformer to apply the associated Templates object to an 
XML document
	// (foo.xml) and write the output to a file (foo.out).
	transformer.transform(new StreamSource("report.xml"), new StreamResult
(new FileOutputStream("report.html")));
	
	System.out.println("************* The result is in report.html 
*************");
  }
}