mmidy 2002/10/28 08:17:34
Modified: java/src/org/apache/xpath Tag: xslt20 SourceTreeManager.java
java/src/org/apache/xpath/functions Tag: xslt20
FuncBoolean.java
java/src/org/apache/xpath/parser Tag: xslt20 SimpleNode.java
java/src/org/apache/xpath/res Tag: xslt20
XPATHErrorResources.java
XPATHErrorResources.properties
Added: java/src/org/apache/xpath/functions Tag: xslt20
FuncCollection.java FuncConcatenate.java
FuncIfAbsent.java FuncIfEmpty.java FuncRoot.java
Log:
New functions. Note, they are very unstable!
Revision Changes Path
No revision
No revision
1.30.10.1 +26 -0
xml-xalan/java/src/org/apache/xpath/SourceTreeManager.java
Index: SourceTreeManager.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/SourceTreeManager.java,v
retrieving revision 1.30
retrieving revision 1.30.10.1
diff -u -r1.30 -r1.30.10.1
--- SourceTreeManager.java 7 Feb 2002 16:03:37 -0000 1.30
+++ SourceTreeManager.java 28 Oct 2002 16:17:33 -0000 1.30.10.1
@@ -70,6 +70,7 @@
//import org.w3c.dom.Document;
import org.apache.xml.dtm.DTM;
+import org.apache.xml.utils.NodeVector;
import javax.xml.transform.URIResolver;
import javax.xml.transform.TransformerException;
@@ -277,6 +278,31 @@
// System.out.println("getNode - returning: "+node);
return DTM.NULL;
+ }
+
+ /**
+ * Given a Source object, find the node associated with it.
+ *
+ * @param source The Source object to act as the key.
+ *
+ * @return The nodes that is associated with the input sequence.
+ */
+ public NodeVector getNodes()
+ {
+
+ NodeVector nl = new NodeVector();
+
+ int n = m_sourceTree.size();
+
+ for (int i = 0; i < n; i++)
+ {
+ SourceTree sTree = (SourceTree) m_sourceTree.elementAt(i);
+
+ nl.addElement(sTree.m_root);
+ }
+
+ // System.out.println("getNode - returning: "+node);
+ return nl;
}
/**
No revision
No revision
1.5.6.1 +22 -1
xml-xalan/java/src/org/apache/xpath/functions/FuncBoolean.java
Index: FuncBoolean.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncBoolean.java,v
retrieving revision 1.5
retrieving revision 1.5.6.1
diff -u -r1.5 -r1.5.6.1
--- FuncBoolean.java 22 Mar 2002 01:04:44 -0000 1.5
+++ FuncBoolean.java 28 Oct 2002 16:17:34 -0000 1.5.6.1
@@ -63,7 +63,12 @@
import org.apache.xpath.XPathContext;
import org.apache.xpath.XPath;
import org.apache.xpath.objects.XObject;
+import org.apache.xpath.objects.XObjectFactory;
import org.apache.xpath.objects.XBoolean;
+import org.apache.xpath.objects.XSequence;
+import org.apache.xpath.objects.XSequenceImpl;
+import org.apache.xpath.objects.XNodeSequenceSingleton;
+import org.apache.xml.dtm.DTMSequence;
/**
* <meta name="usage" content="advanced"/>
@@ -82,7 +87,23 @@
*/
public XObject execute(XPathContext xctxt) throws
javax.xml.transform.TransformerException
{
- return m_arg0.execute(xctxt).bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
+ XSequence seq = m_arg0.execute(xctxt).xseq();
+ Object item;
+ if ((item = seq.next()) != null)
+ {
+ if (item instanceof XNodeSequenceSingleton)
+ {
+ XNodeSequenceSingleton xnss = (XNodeSequenceSingleton)item;
+ //DTMSequence ds = xnss.getDTM().getTypedValue(xnss.getNodeHandle());
+ XObject obj =
XObjectFactory.create(xnss.getDTM().getNodeValue(xnss.getNodeHandle()));
+ return obj.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
+ }
+ else
+ {
+ return ((XSequenceImpl)seq).bool() ? XBoolean.S_TRUE :
XBoolean.S_FALSE;
+ }
+ }
+ return XBoolean.S_FALSE;
}
}
No revision
No revision
1.1.2.1 +300 -0
xml-xalan/java/src/org/apache/xpath/functions/Attic/FuncCollection.java
1.1.2.1 +101 -0
xml-xalan/java/src/org/apache/xpath/functions/Attic/FuncConcatenate.java
1.1.2.1 +123 -0
xml-xalan/java/src/org/apache/xpath/functions/Attic/FuncIfAbsent.java
1.1.2.1 +127 -0
xml-xalan/java/src/org/apache/xpath/functions/Attic/FuncIfEmpty.java
1.1.2.1 +159 -0
xml-xalan/java/src/org/apache/xpath/functions/Attic/FuncRoot.java
No revision
No revision
1.1.2.1.2.14 +22 -1
xml-xalan/java/src/org/apache/xpath/parser/Attic/SimpleNode.java
Index: SimpleNode.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/parser/Attic/SimpleNode.java,v
retrieving revision 1.1.2.1.2.13
retrieving revision 1.1.2.1.2.14
diff -u -r1.1.2.1.2.13 -r1.1.2.1.2.14
--- SimpleNode.java 17 Oct 2002 20:34:57 -0000 1.1.2.1.2.13
+++ SimpleNode.java 28 Oct 2002 16:17:34 -0000 1.1.2.1.2.14
@@ -408,7 +408,28 @@
new FuncSequenceNodeEqual());
m_builtInFunctions.put(
new QName("sequence-deep-equal"),
- new FuncSequenceDeepEqual());
+ new FuncSequenceDeepEqual());
+m_builtInFunctions.put(
+ new QName("deep-equal"),
+ new FuncDeepEqual());
+m_builtInFunctions.put(
+ new QName("collection"),
+ new FuncCollection());
+m_builtInFunctions.put(
+ new QName("concatenate"),
+ new FuncConcatenate());
+m_builtInFunctions.put(
+ new QName("root"),
+ new FuncRoot());
+m_builtInFunctions.put(
+ new QName("if-empty"),
+ new FuncIfEmpty());
+m_builtInFunctions.put(
+ new QName("if-absent"),
+ new FuncIfAbsent());
+/*m_builtInFunctions.put(
+ new QName("input"),
+ new FuncInput());*/
}
/**
No revision
No revision
1.16.2.1.2.2 +7 -1
xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResources.java
Index: XPATHErrorResources.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResources.java,v
retrieving revision 1.16.2.1.2.1
retrieving revision 1.16.2.1.2.2
diff -u -r1.16.2.1.2.1 -r1.16.2.1.2.2
--- XPATHErrorResources.java 10 Oct 2002 14:58:37 -0000 1.16.2.1.2.1
+++ XPATHErrorResources.java 28 Oct 2002 16:17:34 -0000 1.16.2.1.2.2
@@ -467,7 +467,13 @@
/** ER_CANNOT_FIND_COLLATOR */
public static final int ER_CANNOT_FIND_COLLATOR = 86;
-
+
+ /** ER_INVALID_ARG_TO_COLLECTION */
+ public static final int ER_INVALID_ARG_TO_COLLECTION = 87;
+
+ /** ER_CONTEXT_NOT_NODE */
+ public static final int ER_CONTEXT_NOT_NODE = 88;
+
// Warnings...
/** Field WG_LOCALE_NAME_NOT_HANDLED */
1.7.2.1.2.3 +6 -2
xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResources.properties
Index: XPATHErrorResources.properties
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResources.properties,v
retrieving revision 1.7.2.1.2.2
retrieving revision 1.7.2.1.2.3
diff -u -r1.7.2.1.2.2 -r1.7.2.1.2.3
--- XPATHErrorResources.properties 10 Oct 2002 14:58:37 -0000
1.7.2.1.2.2
+++ XPATHErrorResources.properties 28 Oct 2002 16:17:34 -0000
1.7.2.1.2.3
@@ -176,8 +176,12 @@
ER0084=2 or 3
# ER_VARIABLE_ACCESSED_BEFORE_BIND
ER0085=Variable accessed before it is bound!
-# ER_CANNOT_FIND_COLLATOR */
+# ER_CANNOT_FIND_COLLATOR
ER0086=Could not find Collator for {0}
+# ER_INVALID_ARG_TO_COLLECTION
+ER0087=Invalid argument to collection function {0}
+# ER_CONTEXT_NOT_NODE
+ER0088=Context item is not a node
# WG_LOCALE_NAME_NOT_HANDLED
WR0001=locale name in the format-number function not yet handled!
@@ -231,4 +235,4 @@
three=3
oneortwo=1 or 2
twoorthree=2 or 3
-threeorfour = 3 or 4
\ No newline at end of file
+threeorfour=3 or 4
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]