[ http://nagoya.apache.org/jira/browse/XALANJ-903?page=history ]
Henry Zongaro updated XALANJ-903:
---------------------------------
Priority: Critical
> infinite loop is generated in xsl:for-each
> ------------------------------------------
>
> Key: XALANJ-903
> URL: http://nagoya.apache.org/jira/browse/XALANJ-903
> Project: XalanJ2
> Type: Bug
> Components: Xalan-interpretive, transformation
> Versions: 2.3
> Environment: Operating System: Windows NT/2K
> Platform: PC
> Reporter: ruowei wu
> Assignee: Xalan Developers Mailing List
> Priority: Critical
>
> we used to use xalan 2.1.0 to transform, it's ok. but the problem happens in
> xalan 2.3.1 and jdk1.4 is having same problem. The result is like this:
> public String toString()
> {
> String result = "{";
> result += "name=";
> result += name;
>
> result += "name=";
> result += name;
>
> result += "name=";
> result += name;
>
> result += "name=";
> result += name;
>
> result += "name=";
> result += name;
>
> result += "name=";
> result += name;
>
> result += "name=";
> result += name;
> we check the xslt and find it's xsl:for-each that cause this problem. Here
> are
> the xml and xslt
> <DataType>
> <Class name="AttributeDefinition">
> <Description>
> <Paragraph text="This data type specifies the
> minimal schema entries for an attribute."/>
> </Description>
> <Attribute name="name" type="String"
> multiplicity="one"/>
> <Attribute name="definition" type="String"
> multiplicity="one"/>
> <Attribute name="representationCategory" type="String"
> multiplicity="one"/>
> </Class>
> </DataType>
> ================================================================================
> public String toString()
> {
> String result = "{";
> <xsl:for-each select="./Attribute">
> <xsl:variable name="variableTypeNodes" select="id(./@type)"/>
> <xsl:variable name="theAttribute" select="."></xsl:variable>
> <xsl:for-each select="$variableTypeNodes">
> <xsl:variable name="attributeName"/>
> <xsl:text>result += "</xsl:text>
> <xsl:choose>
> <xsl:when test="(count($variableTypeNodes)>1)">
> <xsl:variable name="attrEnumName"
> select="./@name"/>
> <xsl:variable name="attributeName"
> select="concat($theAttribute/@name,'_',$attrEnumName)"/>
> <xsl:value-of
> select="$attributeName"/><xsl:text>=";</xsl:text>
> <xsl:choose>
> <xsl:when
> test="($theAttribute/@multiplicity='one_or_more') or
> ($theAttribute/@multiplicity='zero_or_more')">
> if(<xsl:value-of select="$attributeName"/> != null){
> result += "(";
> for(int i=0; i <<xsl:value-of select="$attributeName"/>.length;
> i++){
> result += <xsl:value-of select="$attributeName"/>[i];
> if(i < <xsl:value-of select="$attributeName"/>.length - 1){
> result += ",";
> }
> }
> result += ")";
> }
> else result += "null";
> </xsl:when>
> <xsl:otherwise>
> result += <xsl:value-of select="$attributeName"/>;
> </xsl:otherwise>
> </xsl:choose>
> </xsl:when>
> <xsl:otherwise>
> <xsl:variable name="attributeName"
> select="$theAttribute/@name"/>
> <xsl:value-of
> select="$attributeName"/><xsl:text>=";</xsl:text>
> <xsl:choose>
> <xsl:when
> test="($theAttribute/@multiplicity='one_or_more') or
> ($theAttribute/@multiplicity='zero_or_more')">
> if(<xsl:value-of select="$attributeName"/> != null){
> result += "(";
> for(int i=0; i <<xsl:value-of select="$attributeName"/>.length;
> i++){
> result += <xsl:value-of select="$attributeName"/>[i];
> if(i < <xsl:value-of select="$attributeName"/>.length - 1){
> result += ",";
> }
> }
> result += ")";
> }
> else result += "null";
> </xsl:when>
> <xsl:otherwise>
> result += <xsl:value-of select="$attributeName"/>
> <xsl:text>;
>
> </xsl:text>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:otherwise>
> </xsl:choose>
> <!-- <xsl:text>=";</xsl:text> -->
> <!-- <xsl:choose>
> <xsl:when
> test="($theAttribute/@multiplicity='one_or_more') or
> (theAttribute/@multiplicity='zero_or_more')">
> if(<xsl:value-of select="$attributeName"/> != null){
> result += "(";
> for(int i=0; i <<xsl:value-of select="$attributeName"/>.length;
> i++){
> result += <xsl:value-of select="$attributeName"/>[i];
> if(i < <xsl:value-of select="$attributeName"/>.length - 1){
> result += ",";
> }
> }
> result += ")";
> }
> else result += "null";
> </xsl:when>
> <xsl:otherwise>
> result += <xsl:value-of select="$attributeName"/>;
> </xsl:otherwise>
> </xsl:choose> -->
> <xsl:if test="not(position() = last())"><xsl:text/><xsl:text/>
> result += ", ";
> </xsl:if>
> </xsl:for-each>
> <xsl:if test="not(position() = last())"><xsl:text>result += ", ";
> </xsl:text></xsl:if>
> </xsl:for-each>
> result += "}";
> return result;
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://nagoya.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]