Committing Christine Li's (jycli@ca.ibm.com) patch for bugzilla #18210.


git-svn-id: https://svn.apache.org/repos/asf/xalan/java/branches/XSLTC_DTM@337357 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/org/apache/xalan/res/XSLTErrorResources.java b/src/org/apache/xalan/res/XSLTErrorResources.java
index d45bc8b..83406a6 100644
--- a/src/org/apache/xalan/res/XSLTErrorResources.java
+++ b/src/org/apache/xalan/res/XSLTErrorResources.java
@@ -2277,7 +2277,7 @@
 //  public static final int WG_EMPTY_SECOND_ARG = 26;
 
     { WG_EMPTY_SECOND_ARG,
-      "Resulting nodeset from second argument of document function is empty. The first agument will be used."},
+      "Resulting nodeset from second argument of document function is empty. Return an empty node-set."},
 
   //Following are the new WARNING keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11)
 
diff --git a/src/org/apache/xalan/res/XSLTErrorResources.properties b/src/org/apache/xalan/res/XSLTErrorResources.properties
index 4e027a3..8f3fd4b 100644
--- a/src/org/apache/xalan/res/XSLTErrorResources.properties
+++ b/src/org/apache/xalan/res/XSLTErrorResources.properties
@@ -655,7 +655,7 @@
 # WG_ILLEGAL_ATTRIBUTE_VALUE 
 WR0025=Illegal value used for attribute {0}\u003a {1}
 # WG_EMPTY_SECOND_ARG 
-WR0026=Resulting nodeset from second argument of document function is empty. The first agument will be used.
+WR0026=Resulting nodeset from second argument of document function is empty. Return an empty node-set.
 
 # Note to translators:  "name" and "xsl:processing-instruction" are keywords
 # and must not be translated.
diff --git a/src/org/apache/xalan/templates/FuncDocument.java b/src/org/apache/xalan/templates/FuncDocument.java
index 7815837..659a7e0 100644
--- a/src/org/apache/xalan/templates/FuncDocument.java
+++ b/src/org/apache/xalan/templates/FuncDocument.java
@@ -130,11 +130,14 @@
         int baseNode = arg2.iter().nextNode();
 
         if (baseNode == DTM.NULL)
-          warn(xctxt, XSLTErrorResources.WG_EMPTY_SECOND_ARG, null);
-        
-        DTM baseDTM = xctxt.getDTM(baseNode);
-        base = baseDTM.getDocumentBaseURI();
-
+        {
+          	warn(xctxt, XSLTErrorResources.WG_EMPTY_SECOND_ARG, null);
+          	XNodeSet nodes = new XNodeSet(xctxt.getDTMManager());
+   	        return nodes;
+        }else{
+	        DTM baseDTM = xctxt.getDTM(baseNode);
+    	    base = baseDTM.getDocumentBaseURI();
+        }
         // %REVIEW% This doesn't seem to be a problem with the conformance
         // suite, but maybe it's just not doing a good test?
 //        int baseDoc = baseDTM.getDocument();