morten 01/10/15 03:02:46
Modified: java/src/org/apache/xalan/xsltc/compiler Mode.java
java/src/org/apache/xalan/xsltc/dom DOMImpl.java
Log:
Fix for the "*" pattern. Made it include comment and PI nodes.
PR: bugzilla 4050
Obtained from: n/a
Submitted by: [EMAIL PROTECTED]
Reviewed by: [EMAIL PROTECTED]
Revision Changes Path
1.7 +3 -5
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Mode.java
Index: Mode.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Mode.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Mode.java 2001/10/15 09:13:22 1.6
+++ Mode.java 2001/10/15 10:02:46 1.7
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: Mode.java,v 1.6 2001/10/15 09:13:22 morten Exp $
+ * @(#)$Id: Mode.java,v 1.7 2001/10/15 10:02:46 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -722,8 +722,7 @@
targets[DOM.ATTRIBUTE] = attrNamespaceHandle;
// Match on processing instruction - default: process next node
- InstructionHandle ihPI = ihLoop;
- if (_nodeTestSeq != null) ihPI = ihElem;
+ InstructionHandle ihPI = ihElem;
if (_testSeq[DOM.PROCESSING_INSTRUCTION] != null)
targets[DOM.PROCESSING_INSTRUCTION] =
_testSeq[DOM.PROCESSING_INSTRUCTION].
@@ -732,8 +731,7 @@
targets[DOM.PROCESSING_INSTRUCTION] = ihPI;
// Match on comments - default: process next node
- InstructionHandle ihComment = ihLoop;
- if (_nodeTestSeq != null) ihComment = ihElem;
+ InstructionHandle ihComment = ihElem;
targets[DOM.COMMENT] = _testSeq[DOM.COMMENT] != null
? _testSeq[DOM.COMMENT].compile(classGen, methodGen, ihComment)
: ihComment;
1.43 +12 -2
xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMImpl.java
Index: DOMImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMImpl.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- DOMImpl.java 2001/10/12 14:11:24 1.42
+++ DOMImpl.java 2001/10/15 10:02:46 1.43
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: DOMImpl.java,v 1.42 2001/10/12 14:11:24 morten Exp $
+ * @(#)$Id: DOMImpl.java,v 1.43 2001/10/15 10:02:46 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -174,7 +174,9 @@
* Returns 'true' if a specific node is an element (of any type)
*/
private boolean isElement(final int node) {
- if ((node<_firstAttributeNode) && (_type[node]>=NTYPES)) return true;
+ final int type = _type[node];
+ if ((node<_firstAttributeNode) &&
+ (type>=PROCESSING_INSTRUCTION)) return true;
return false;
}
@@ -195,6 +197,10 @@
* Returns true if node1 comes before node2 in document order
*/
public boolean lessThan(int node1, int node2) {
+ // Hack for ordering attribute nodes
+ if (node1 >= _firstAttributeNode) node1 = _parent[node1];
+ if (node2 >= _firstAttributeNode) node2 = _parent[node2];
+
if ((node2 < _treeNodeLimit) && (node1 < node2))
return(true);
else
@@ -2475,6 +2481,10 @@
copyPI(node, handler);
return null;
case COMMENT:
+ final String comment = new String(_text,
+ _offsetOrChild[node],
+ _lengthOrAttr[node]);
+ handler.comment(comment);
return null;
default:
if (isElement(node)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]