sboag       01/06/04 06:48:37

  Modified:    java/src/org/apache/xalan/templates Tag: DTM_EXP
                        FuncDocument.java
  Log:
  Fixed a problem with the URI resolver being called twice.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.19.2.8  +18 -5     xml-xalan/java/src/org/apache/xalan/templates/FuncDocument.java
  
  Index: FuncDocument.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/FuncDocument.java,v
  retrieving revision 1.19.2.7
  retrieving revision 1.19.2.8
  diff -u -r1.19.2.7 -r1.19.2.8
  --- FuncDocument.java 2001/05/18 07:16:19     1.19.2.7
  +++ FuncDocument.java 2001/06/04 13:48:37     1.19.2.8
  @@ -121,12 +121,12 @@
      */
     public XObject execute(XPathContext xctxt) throws 
javax.xml.transform.TransformerException
     {
  -
       int context = xctxt.getCurrentNode();
       DTM dtm = xctxt.getDTM(context);
       
       int docContext = dtm.getDocument();
       XObject arg = (XObject) this.getArg0().execute(xctxt);
  +
       String base = "";
       Expression arg1Expr = this.getArg1();
   
  @@ -256,11 +256,12 @@
   
       // System.out.println("base: "+base+", uri: "+uri);
       SourceTreeManager treeMgr = xctxt.getSourceTreeManager();
  -    
  +    Source source;
  +   
       int newDoc;
       try
       {
  -      Source source = treeMgr.resolveURI(base, uri, xctxt.getSAXLocator());
  +      source = treeMgr.resolveURI(base, uri, xctxt.getSAXLocator());
         newDoc = treeMgr.getNode(source);
       }
       catch (IOException ioe)
  @@ -278,7 +279,19 @@
   
       // If the uri length is zero, get the uri of the stylesheet.
       if (uri.length() == 0)
  +    {
  +      // Hmmm... this seems pretty bogus to me... -sb
         uri = xctxt.getNamespaceContext().getBaseIdentifier();
  +      try
  +      {
  +        source = treeMgr.resolveURI(base, uri, xctxt.getSAXLocator());
  +      }
  +      catch (IOException ioe)
  +      {
  +        throw new TransformerException(ioe.getMessage(), 
  +          (SourceLocator)xctxt.getSAXLocator(), ioe);
  +      }
  +    }
   
       String diagnosticsString = null;
   
  @@ -286,7 +299,7 @@
       {
         if ((null != uri) && (uri.toString().length() > 0))
         {
  -        newDoc = treeMgr.getSourceTree(base, uri, xctxt.getSAXLocator(), xctxt);
  +        newDoc = treeMgr.getSourceTree(source, xctxt.getSAXLocator(), xctxt);
   
           // System.out.println("newDoc: 
"+((Document)newDoc).getDocumentElement().getNodeName());
         }
  @@ -452,6 +465,6 @@
     public void checkNumberArgs(int argNum) throws WrongNumberArgsException
     {
       if ((argNum < 1) || (argNum > 2))
  -      throw new WrongNumberArgsException("2");
  +      throw new WrongNumberArgsException("1 or 2");
     }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to