PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL BE LOST SOMEWHERE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3320 *** shadow/3320 Tue Aug 28 14:08:22 2001 --- shadow/3320.tmp.15172 Tue Aug 28 14:08:22 2001 *************** *** 0 **** --- 1,111 ---- + +============================================================================+ + | xsltc fails conf test copy40 saying attribute outside element | + +----------------------------------------------------------------------------+ + | Bug #: 3320 Product: XalanJ2 | + | Status: NEW Version: 2.0.0 | + | Resolution: Platform: Sun | + | Severity: Normal OS/Version: Solaris | + | Priority: Other Component: org.apache.xalan.xsltc | + +----------------------------------------------------------------------------+ + | Assigned To: [EMAIL PROTECTED] | + | Reported By: [EMAIL PROTECTED] | + | CC list: Cc: | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + Looks like xsltc has trouble when an <xsl:attribute> instruction + is used within an <xsl:copy> instruction. Here is the key snippet of + the stylesheet: + + <xsl:copy> + <xsl:copy-of select="@level"/> + <xsl:attribute name="data"> + <xsl:value-of select="text()"/> + </xsl:attribute> + </xsl:copy> + + The <xsl:copy> instruction should initiate the copying of the current + node. The copy-of should add the "level" attribute. The <xsl:attribute> + instruction should add an attribute named "data" whose value is obtained + from the content of the text node that is the child of the current node. + The problem is that xsltc says the attribute "data" is outside the + element. Saxon and Xalan do not complain. + + The following test session provides more information: + + Running xalan on copy40 + <?xml version="1.0" encoding="UTF-8"?> + <out><a level="1" data="1a2"/> + <a level="2" data="2a3"/> + <a level="3" data="2xa2"/> + <a level="3" data="2xa3"/> + </out> + + + Running XSLTC with Xerces Parser on copy40 + Warning: + file:/net/bigblock/files18/tamiro/xml-xalan/test/tests/conf/copy/copy40.xsl: + Attribute 'data' outside of element. + <?xml version="1.0" encoding="utf-8" ?> + <out><a level="1"/> + <a level="2"/> + <a level="3"/> + <a level="3"/> + </out> + + cat copy40.xsl + <?xml version="1.0"?> + <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + + <!-- FileName: copy40 --> + <!-- Document: http://www.w3.org/TR/xslt --> + <!-- DocVersion: 19991116 --> + <!-- Section: 11.3 Using Values of Variables & Parameters with xsl:copy-of. + --> + <!-- Creator: David Marston --> + <!-- Purpose: Use key() to get nodes from various places, then copy and mark. + --> + + <xsl:key name="k" use="@origin" match="a" /> + + <xsl:template match="/"> + <out> + <xsl:for-each select="key('k','Albany')"> + <xsl:copy> + <xsl:copy-of select="@level"/> + <xsl:attribute name="data"><!-- Mark copied 'a' nodes with their data + --> + <xsl:value-of select="text()"/> + </xsl:attribute> + </xsl:copy><xsl:text> + </xsl:text> + </xsl:for-each> + </out> + </xsl:template> + + </xsl:stylesheet> + + cat copy40.xml + <?xml version="1.0"?> + <docs> + <doc1> + <a level="1" origin="house">1a1</a> + <a level="1" origin="Albany">1a2</a> + <doc1supplement> + <a level="1" origin="Austin">1xa1</a> + </doc1supplement> + </doc1> + <doc2> + <a level="2" origin="Baltimore">2a1</a> + <b level="2" origin="Albany">2b1</b> + <a level="2" origin="Portland">2a2</a> + <a level="2" origin="Albany">2a3</a> + <doc2supplement> + <a level="3" origin="Chicago">2xa1</a> + <a level="3" origin="Albany">2xa2</a> + <a level="3" origin="Albany">2xa3</a> + <d level="3" origin="Albany">2xd1</d> + </doc2supplement> + </doc2> + </docs>
