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/02/05 21:42:29 UTC

DO NOT REPLY [Bug 26698] New: - Attribute value template throws RuntimeException

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

Attribute value template throws RuntimeException

           Summary: Attribute value template throws RuntimeException
           Product: XalanJ2
           Version: CurrentCVS
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Xalan-Xsltc
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: minchau@ca.ibm.com


ERROR:  'Namespace for prefix 'foo' has not been declared.'
is emitted but the namespace was declared on the xsl:template element.
-----------------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
  xmlns:foo="bar"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="par" select="'foo:abc'" />
<xsl:template match="/">
  <out>
  	<xsl:element name="{$par}">test</xsl:element>
  </out>
</xsl:template>
</xsl:stylesheet>
-----------------------------------------------------------

The problem is in org.apache.xalan.xsltc.runtime.BasisLibrary.
The method startXslElement(...) recognizes that the mapping of prefix to URI
is unknown, but it asks the DOM for help.  I think the DOM represents either the
input document or the stylesheet, but in either case the prefix might or
might not be mapped at this point and it is the result-tree that is being 
built that would know the answer to whether the prefix, "foo" in the testcase
maps to a URI.  I'm attaching a patch soon where this method asks the 
SerializationHandler for help.

Thanks to Joanne Tong for pointing out the bug and the testcase.
- Brian Minchau