You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mm...@locus.apache.org on 2000/08/17 20:31:45 UTC
cvs commit: xml-xalan/src/org/apache/xalan/xslt/res XSLTErrorResources.java
mmidy 00/08/17 11:31:42
Modified: src/org/apache/xalan/xpath MutableNodeListImpl.java
src/org/apache/xalan/xslt FuncDocument.java
src/org/apache/xalan/xslt/res XSLTErrorResources.java
Log:
Warn when resulting nodeset from second arg of document function is empty, and default to first argument
Revision Changes Path
1.12 +25 -4 xml-xalan/src/org/apache/xalan/xpath/MutableNodeListImpl.java
Index: MutableNodeListImpl.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/MutableNodeListImpl.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- MutableNodeListImpl.java 2000/03/06 23:33:10 1.11
+++ MutableNodeListImpl.java 2000/08/17 18:31:37 1.12
@@ -383,6 +383,7 @@
// is somewhat tough because the sequence test involves
// two nodes.
int size = size(), i;
+ //boolean isNewDoc = false;
for(i = size-1; i >= 0; i--)
{
Node child = (Node)elementAt(i);
@@ -391,14 +392,34 @@
i = -2; // Duplicate, suppress insert
break;
}
- if(!isNodeAfter(node, child, support))
+ // previous check already takes care of equal doc nodes
+ /*if ((child.getOwnerDocument() == node.getOwnerDocument() && null != child.getOwnerDocument())
+ || child.getOwnerDocument()== node
+ || node.getOwnerDocument() == child )
{
- break;
- }
+ isNewDoc = false; */
+ if(!isNodeAfter(node, child, support))
+ {
+ break;
+ }
+ /* }
+ // The assumption here is that the nodes in the original nodelist
+ // are already in document (access) order. After having made sure
+ // that it's not from documents already in the list, we then can just
+ // add this node from a different document to the end of the list.
+ // Since we are always comparing against the last element first, even
+ // if this last node is from document 1+n, the new node
+ // (if also from document 1+n) will be compared to nodes from document
+ // 1+n first, and will be inserted appropriately.
+ else
+ isNewDoc = true;*/
}
if(i != -2)
{
- insertIndex = i+1;
+ // if (isNewDoc)
+ // insertIndex = size;
+ // else
+ insertIndex = i+1;
insertElementAt(node, insertIndex);
}
}
1.16 +5 -3 xml-xalan/src/org/apache/xalan/xslt/FuncDocument.java
Index: FuncDocument.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/FuncDocument.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- FuncDocument.java 2000/08/11 05:36:13 1.15
+++ FuncDocument.java 2000/08/17 18:31:38 1.16
@@ -110,10 +110,12 @@
if(XObject.CLASS_NODESET == arg2.getType())
{
Node baseNode = arg2.nodeset().item(0);
- Document baseDoc = (Node.DOCUMENT_NODE == baseNode.getNodeType()) ?
- (Document)baseNode : baseNode.getOwnerDocument();
+ if (baseNode == null)
+ warn(execContext, XSLTErrorResources.WG_EMPTY_SECOND_ARG, null);
+ Document baseDoc = (baseNode == null ? null :(Node.DOCUMENT_NODE == baseNode.getNodeType()) ?
+ (Document)baseNode : baseNode.getOwnerDocument());
- if(baseDoc instanceof Stylesheet)
+ if( baseDoc == null || baseDoc instanceof Stylesheet)
{
// base = ((Stylesheet)baseDoc).getBaseIdentifier();
base = execContext.getNamespaceContext().getBaseIdentifier();
1.23 +6 -1 xml-xalan/src/org/apache/xalan/xslt/res/XSLTErrorResources.java
Index: XSLTErrorResources.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/res/XSLTErrorResources.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- XSLTErrorResources.java 2000/07/19 14:21:17 1.22
+++ XSLTErrorResources.java 2000/08/17 18:31:41 1.23
@@ -77,7 +77,7 @@
public static final String WARNING_SUFFIX = "WR";
public static final int MAX_CODE = 104; // this is needed to keep track of the number of messages
-public static final int MAX_WARNING = 25; // this is needed to keep track of the number of warnings
+public static final int MAX_WARNING = 26; // this is needed to keep track of the number of warnings
public static final int MAX_OTHERS = 41;
public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING +1;
@@ -762,6 +762,11 @@
public static final int WG_ILLEGAL_ATTRIBUTE_VALUE = 25;
static {contents[WG_ILLEGAL_ATTRIBUTE_VALUE + MAX_CODE][1]
= "Illegal value used for attribute {0}: {1}";
+}
+
+public static final int WG_EMPTY_SECOND_ARG = 26;
+static {contents[WG_EMPTY_SECOND_ARG + MAX_CODE][1]
+ = "Resulting nodeset from second argument of document function is empty. The first agument will be used.";
}