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 2001/06/25 20:15:30 UTC
[Bug 2313] New: - NPE if attempt to copy an attribute to result tree if no element output
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2313
*** shadow/2313 Mon Jun 25 11:15:30 2001
--- shadow/2313.tmp.28639 Mon Jun 25 11:15:30 2001
***************
*** 0 ****
--- 1,43 ----
+ +============================================================================+
+ | NPE if attempt to copy an attribute to result tree if no element output |
+ +----------------------------------------------------------------------------+
+ | Bug #: 2313 Product: XalanJ2 |
+ | Status: NEW Version: 2.1.0 |
+ | Resolution: Platform: PC |
+ | Severity: Minor OS/Version: Windows NT/2K |
+ | Priority: Other Component: org.apache.xalan.transf |
+ +----------------------------------------------------------------------------+
+ | Assigned To: xalan-dev@xml.apache.org |
+ | Reported By: Joel.Crisp@trilogy.com |
+ | CC list: Cc: |
+ +----------------------------------------------------------------------------+
+ | URL: |
+ +============================================================================+
+ | DESCRIPTION |
+ If you attempt to copy an attribute to a result tree without first copying the
+ enclosing element, and there is no prior element in the result tree, then the
+ copy thows an NPE. Should generate an error message informing user that there
+ is no current node to associate the attribute with.
+
+ <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/TR/xhtml1/strict"
+ xmlns:xml="http://www.w3.org/XML/1998/namespace"
+ xmlns:xalan="http://xml.apache.org/xslt">
+
+ <xsl:template match="/toplevel">
+ <!-- <xsl:copy> -->
+ <xsl:apply-templates select="@*|node()"/>
+ <!-- </xsl:copy> -->
+ </xsl:template>
+
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ </xsl:transform>
+
+ with input :
+
+ <toplevel an-attribute="foo"/>
\ No newline at end of file