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=6585>.
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=6585

<xsl:for-each select="id(@idrefs)"/> loops

           Summary: <xsl:for-each select="id(@idrefs)"/> loops
           Product: XalanJ2
           Version: 2.0.3
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Xalan-CmdLine
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Given the xml document:
<?xml version="1.0"?>
<!DOCTYPE document [
        <!ELEMENT document ( ( refd )+, test )>

        <!ELEMENT refd EMPTY>
        <!ATTLIST refd
                id ID #REQUIRED
                name CDATA #REQUIRED
                >

        <!ELEMENT test EMPTY>
        <!ATTLIST test
                refids IDREFS #REQUIRED
                >
]>

<document>
        <refd id="first" name="1st"/>
        <refd id="second" name="2nd"/>
        <refd id="third" name="3rd"/>

        <test refids="first second third"/>
</document>

and the stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        version="1.0">

        <xsl:output method="text"/>

        <xsl:template match="/">
                <xsl:apply-templates select="document"/>
        </xsl:template>

        <xsl:template match="document">
                <xsl:apply-templates select="test"/>
        </xsl:template>

        <xsl:template match="test">
                <xsl:for-each select="id( @refids )">
                        <xsl:value-of select="@name"/>
                        <xsl:if test="not(position()=last())">
                                <xsl:text>, </xsl:text>
                        </xsl:if>
                </xsl:for-each>
        </xsl:template>
</xsl:stylesheet>

The Xalan-j 2.0.3 XSLT from the command line loops:
$ java org.apache.xalan.xslt.Process -in id-test.xml -xsl id-test.xsl
1st, 3rd3rd3rd3rd3rd3rd3rd3rd3rd3rd3rd ...

TIA
Bill Somerville.

Reply via email to