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 2004/08/30 20:08:19 UTC

DO NOT REPLY [Bug 30943] New: - XSL-T Stylesheet Succeeds With Small Stream, Fails With Large

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=30943

XSL-T Stylesheet Succeeds With Small Stream, Fails With Large

           Summary: XSL-T Stylesheet Succeeds With Small Stream, Fails With
                    Large
           Product: XalanJ2
           Version: 2.6
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: duffymo@yahoo.com


I wrote a simple XSL-T stylesheet to make the following change to an XML stream:

"Copy out the input stream elements into the output stream.  If you find a 
<queryItem> whose <datatype> child has the value 'character', add the following 
element after the <nullable> child:

<promptInfo>
    <promptType>selectWithSearch</promptType>
</promptInfo>
"

This is the stylesheet that I wrote:

<!--
A simple stylesheet for adding a tag to a document 
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">



    <!-- Copy the document in its entirety -->
    <xsl:template match="*|@*|comment()|processing-instruction()|text()">
        <xsl:copy>
            <xsl:apply-templates select="*|@*|comment()|processing-instruction()
|text()"/>
        </xsl:copy>
    </xsl:template>

    
    
    <!--  Find the queryItem tag and add a promptInfo child after nulllable for 
character datatype-->
    <xsl:template match="queryItem">
        <queryItem>
            <xsl:apply-templates select="name"/>
            <xsl:apply-templates select="lastChanged"/>
            <xsl:apply-templates select="columnName"/>
            <xsl:apply-templates select="usage"/>
            <xsl:apply-templates select="datatype"/>
            <xsl:apply-templates select="precision"/>
            <xsl:apply-templates select="scale"/>
            <xsl:apply-templates select="size"/>
            <xsl:apply-templates select="nullable"/>
            <xsl:if test="datatype/text()='character'">
                <promptInfo>
                    <promptType>selectWithSearch</promptType>
                </promptInfo>
            </xsl:if>
            <xsl:apply-templates select="regularAggregate"/>
            <xsl:apply-templates select="semiAggregate"/>
        </queryItem>
    </xsl:template>

</xsl:stylesheet>

I apply it to this simple XML stream:

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <name>KMC Master Model</name>
    <locales>
        <locale>en-US</locale>
    </locales>
    <namespace>
        <querySubject>
         <queryItem>
            <name locale="en-us">Create Date</name>
            <name locale="en-gb">_create_date</name>
            <lastChanged>2004-07-23T14:31:46</lastChanged>
            <columnName>_create_date</columnName>
            <usage>identifier</usage>
            <datatype>date</datatype>
            <precision>0</precision>
            <scale>0</scale>
            <size>4</size>
            <nullable>true</nullable>
            <regularAggregate>unsupported</regularAggregate>
            <semiAggregate>unsupported</semiAggregate>
         </queryItem>
         <queryItem>
            <name locale="en-us">Ref Code</name>
            <name locale="en-gb">_ref_code</name>
            <lastChanged>2004-07-23T14:31:46</lastChanged>
            <columnName>_ref_code</columnName>
            <usage>identifier</usage>
            <datatype>character</datatype>
            <precision>15</precision>
            <scale>0</scale>
            <size>32</size>
            <nullable>true</nullable>
            <regularAggregate>unsupported</regularAggregate>
            <semiAggregate>unsupported</semiAggregate>
            <collationSequenceName>IF_CS819</collationSequenceName>
            <collationSequenceLevel>0</collationSequenceLevel>
         </queryItem>
        </querySubject>
    </namespace>
</project>

The output is as expected (<promptType> child not added for the first 
<queryItem>; added for the second one):

<?xml version="1.0" encoding="UTF-8"?>
<project>
   <name>KMC Master Model</name>
   <locales>
      <locale>en-US</locale>
   </locales>
   <namespace>
      <querySubject>
         <queryItem>
            <name locale="en-us">Create Date</name>
            <name locale="en-gb">_create_date</name>
            <lastChanged>2004-07-23T14:31:46</lastChanged>
            <columnName>_create_date</columnName>
            <usage>identifier</usage>
            <datatype>date</datatype>
            <precision>0</precision>
            <scale>0</scale>
            <size>4</size>
            <nullable>true</nullable>
            <regularAggregate>unsupported</regularAggregate>
            <semiAggregate>unsupported</semiAggregate>
         </queryItem>
         <queryItem>
            <name locale="en-us">Ref Code</name>
            <name locale="en-gb">_ref_code</name>
            <lastChanged>2004-07-23T14:31:46</lastChanged>
            <columnName>_ref_code</columnName>
            <usage>identifier</usage>
            <datatype>character</datatype>
            <precision>15</precision>
            <scale>0</scale>
            <size>32</size>
            <nullable>true</nullable>
            <promptInfo>
               <promptType>selectWithSearch</promptType>
            </promptInfo>
            <regularAggregate>unsupported</regularAggregate>
            <semiAggregate>unsupported</semiAggregate>
         </queryItem>
      </querySubject>
   </namespace>
</project>

However, when I apply the identical transformation to a larger stream (3.7MB), 
which was the source of the <queryItem> instances used in the small test 
stream, I find that the original stream is copied out, and NO <promptType> 
children are added.  No exceptions were thrown.

I used -Xmx128m as an argument when I ran xalan.jar, without effect.  Why would 
a transformation succeed on a smaller XML input stream and fail on a larger one?

MOD

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