You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by un...@apache.org on 2004/01/21 18:05:09 UTC

cvs commit: cocoon-2.1/tools/src/anttasks XConfToolTask.java

unico       2004/01/21 09:05:09

  Modified:    tools/src/anttasks XConfToolTask.java
  Log:
  allow nodeset results for insert-before and insert-after xpath expressions
  this should also fix the build issue with slide block xpatch file described here: http://marc.theaimsgroup.com/?t=107210314800003&r=1&w=2
  
  Revision  Changes    Path
  1.11      +7 -10     cocoon-2.1/tools/src/anttasks/XConfToolTask.java
  
  Index: XConfToolTask.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/tools/src/anttasks/XConfToolTask.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XConfToolTask.java	23 Nov 2003 10:13:11 -0000	1.10
  +++ XConfToolTask.java	21 Jan 2004 17:05:09 -0000	1.11
  @@ -318,24 +318,21 @@
   
               if ((xpath!=null) && (xpath.length()>0)) {
                   nodes = XPathAPI.selectNodeList(root, xpath);
  -                if (nodes.getLength()!=1) {
  +                if (nodes.getLength()==0) {
                       log("Error in: "+file);
  -                    throw new IOException("XPath ("+xpath+
  -                                          ") returned not one node, but "+
  -                                          nodes.getLength()+" nodes");
  +                    throw new IOException("XPath ("+xpath+") returned zero nodes");
                   }
                   before = nodes.item(0);
               } else {
                   xpath = getAttribute(elem, "insert-after", replaceProperties);
                   if ((xpath!=null) && (xpath.length()>0)) {
                       nodes = XPathAPI.selectNodeList(root, xpath);
  -                    if (nodes.getLength()!=1) {
  +                    if (nodes.getLength()==0) {
                           log("Error in: "+file);
  -                        throw new IOException("XPath ("+xpath+
  -                                              ") returned not one node, but "+
  -                                              nodes.getLength()+" nodes");
  +                        throw new IOException("XPath ("+xpath+") zero nodes.");
                       }
  -                    before = nodes.item(0).getNextSibling();
  +                    
  +                    before = nodes.item(nodes.getLength()-1).getNextSibling();
                   }
               }