1 16 19 package org.apache.xpath.functions; 20 21 import org.apache.xml.dtm.DTM; 22 import org.apache.xpath.XPathContext; 23 import org.apache.xpath.objects.XObject; 24 import org.apache.xpath.objects.XString; 25 26 31 public class FuncDoclocation extends FunctionDef1Arg 32 { 33 34 42 public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException 43 { 44 45 int whereNode = getArg0AsNode(xctxt); 46 String fileLocation = null; 47 48 if (DTM.NULL != whereNode) 49 { 50 DTM dtm = xctxt.getDTM(whereNode); 51 52 if (DTM.DOCUMENT_FRAGMENT_NODE == dtm.getNodeType(whereNode)) 54 { 55 whereNode = dtm.getFirstChild(whereNode); 56 } 57 58 if (DTM.NULL != whereNode) 59 { 60 fileLocation = dtm.getDocumentBaseURI(); 61 } 64 } 65 66 return new XString((null != fileLocation) ? fileLocation : ""); 67 } 68 } 69 | Popular Tags |