Return-Path: Delivered-To: apmail-jakarta-taglibs-dev-archive@www.apache.org Received: (qmail 79135 invoked from network); 15 Sep 2004 20:22:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 15 Sep 2004 20:22:23 -0000 Received: (qmail 30192 invoked by uid 500); 15 Sep 2004 20:22:23 -0000 Delivered-To: apmail-jakarta-taglibs-dev-archive@jakarta.apache.org Received: (qmail 30073 invoked by uid 500); 15 Sep 2004 20:22:21 -0000 Mailing-List: contact taglibs-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tag Libraries Developers List" Reply-To: "Tag Libraries Developers List" Delivered-To: mailing list taglibs-dev@jakarta.apache.org Received: (qmail 30060 invoked by uid 500); 15 Sep 2004 20:22:21 -0000 Received: (qmail 30056 invoked by uid 99); 15 Sep 2004 20:22:21 -0000 X-ASF-Spam-Status: No, hits=-10.0 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 15 Sep 2004 13:22:20 -0700 Received: (qmail 79108 invoked by uid 1131); 15 Sep 2004 20:22:19 -0000 Date: 15 Sep 2004 20:22:19 -0000 Message-ID: <20040915202219.79107.qmail@minotaur.apache.org> From: horwat@apache.org To: jakarta-taglibs-cvs@apache.org Subject: cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/xml XPathUtil.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N horwat 2004/09/15 13:22:19 Modified: standard/doc/web ReleaseNotes.html standard/src/org/apache/taglibs/standard/tag/common/xml XPathUtil.java Log: Bugzilla #31147 Fixed XPath Expression evaluation so that expressions are evaluated relative to the document Node as opposed to only the document Root. Kris Schneider Flavio Tordini Revision Changes Path 1.58 +9 -1 jakarta-taglibs/standard/doc/web/ReleaseNotes.html Index: ReleaseNotes.html =================================================================== RCS file: /home/cvs/jakarta-taglibs/standard/doc/web/ReleaseNotes.html,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- ReleaseNotes.html 3 Sep 2004 17:09:59 -0000 1.57 +++ ReleaseNotes.html 15 Sep 2004 20:22:18 -0000 1.58 @@ -60,9 +60,17 @@ + + + + + +

Fixed XPath Expression evaluation so that the expressions are evaluated relative to the document Node as opposed to the document Root.

+ + -

Other changes and additions:

1.19 +12 -5 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java Index: XPathUtil.java =================================================================== RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- XPathUtil.java 16 Aug 2004 21:38:29 -0000 1.18 +++ XPathUtil.java 15 Sep 2004 20:22:19 -0000 1.19 @@ -433,6 +433,13 @@ } return null; } + + private static Document getDocumentForNode(Node node) { + Document doc = getDummyDocumentWithoutRoot(); + Node importedNode = doc.importNode(node, true); + doc.appendChild(importedNode); + return doc; + } // The following variable is used for holding the modified xpath string // when adapting parameter for Xalan XPath engine, where we need to have @@ -675,10 +682,7 @@ if ( Class.forName("org.w3c.dom.Node").isInstance( jstlNodeList.elementAt(0) ) ) { Node node = (Node)jstlNodeList.elementAt(0); - Document doc = getDummyDocumentWithoutRoot(); - Node importedNode = doc.importNode( node, true); - doc.appendChild (importedNode ); - boundDocument = doc; + boundDocument = getDocumentForNode(node); if ( whetherOrigXPath ) { xpath="/*" + xpath; } @@ -723,7 +727,10 @@ } } else if ( Class.forName("org.w3c.dom.Node").isInstance( varObject ) ) { - boundDocument = (Node)varObject; + boundDocument = getDocumentForNode((Node)varObject); + if (whetherOrigXPath) { + xpath = "/*" + xpath; + } } else { boundDocument = getDummyDocument(); xpath = origXPath; --------------------------------------------------------------------- To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org