You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by pi...@apache.org on 2003/05/01 02:06:22 UTC
cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/xml JSTLXPathAPI.java
pierred 2003/04/30 17:06:21
Modified: standard/src/org/apache/taglibs/standard/tag/common/xml
JSTLXPathAPI.java
Log:
More fixes for integration with xalan. Thanks Ramesh.
Revision Changes Path
1.3 +32 -0 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/xml/JSTLXPathAPI.java
Index: JSTLXPathAPI.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/xml/JSTLXPathAPI.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JSTLXPathAPI.java 22 Apr 2003 22:14:54 -0000 1.2
+++ JSTLXPathAPI.java 1 May 2003 00:06:21 -0000 1.3
@@ -57,6 +57,8 @@
package org.apache.taglibs.standard.tag.common.xml;
+import java.util.Vector;
+
import javax.servlet.jsp.JspTagException;
import javax.xml.transform.TransformerException;
@@ -321,4 +323,34 @@
Resources.getMessage("XPATH_ILLEGAL_ARG_EVALUATING_EXPR", str, ex.getMessage()), ex);
}
}
+
+ public static XObject eval(
+ Node contextNode, String str, PrefixResolver prefixResolver,
+ XPathContext xpathSupport, Vector varQNames) throws JspTagException {
+ //p("***************** eval ");
+ //p( "contextNode => " + contextNode );
+ //p( "XPath str => " + str );
+ //p( "PrefixResolver => " + prefixResolver );
+ //p( "XPath Context => " + xpathSupport );
+ //p( "Var QNames => " + varQNames );
+ //p( "Global Var Size => " + varQNames.size() );
+ try {
+ XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
+ xpath.fixupVariables( varQNames, varQNames.size());
+ // Execute the XPath, and have it return the result
+ int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);
+ // System.out.println("Context Node id ( after getDTMHandlerFromNode) => " + ctxtNode );
+ return xpath.execute(xpathSupport, ctxtNode, prefixResolver);
+ } catch (TransformerException ex) {
+ throw new JspTagException(
+ Resources.getMessage("XPATH_ERROR_EVALUATING_EXPR", str, ex.getMessage()), ex);
+ } catch (IllegalArgumentException ex) {
+ throw new JspTagException(
+ Resources.getMessage("XPATH_ILLEGAL_ARG_EVALUATING_EXPR", str, ex.getMessage()), ex);
+ }
+ }
+
+ private static void p(String s) {
+ System.out.println("[JSTLXPathAPI] " + s);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org