1 16 package com.sun.org.apache.xpath.internal.functions; 17 18 import com.sun.org.apache.xalan.internal.templates.Constants; 19 import com.sun.org.apache.xml.internal.utils.QName; 21 import com.sun.org.apache.xpath.internal.ExtensionsProvider; 22 import com.sun.org.apache.xpath.internal.XPathContext; 23 import com.sun.org.apache.xpath.internal.objects.XBoolean; 24 import com.sun.org.apache.xpath.internal.objects.XObject; 25 26 30 public class FuncExtElementAvailable extends FunctionOneArg 31 { 32 33 41 public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException 42 { 43 44 String prefix; 45 String namespace; 46 String methName; 47 48 String fullName = m_arg0.execute(xctxt).str(); 49 int indexOfNSSep = fullName.indexOf(':'); 50 51 if (indexOfNSSep < 0) 52 { 53 prefix = ""; 54 namespace = Constants.S_XSLNAMESPACEURL; 55 methName = fullName; 56 } 57 else 58 { 59 prefix = fullName.substring(0, indexOfNSSep); 60 namespace = xctxt.getNamespaceContext().getNamespaceForPrefix(prefix); 61 if (null == namespace) 62 return XBoolean.S_FALSE; 63 methName= fullName.substring(indexOfNSSep + 1); 64 } 65 66 if (namespace.equals(Constants.S_XSLNAMESPACEURL) 67 || namespace.equals(Constants.S_BUILTIN_EXTENSIONS_URL)) 68 { 69 76 return XBoolean.S_FALSE; 77 } 78 else 79 { 80 ExtensionsProvider extProvider = (ExtensionsProvider)xctxt.getOwnerObject(); 82 return extProvider.elementAvailable(namespace, methName) 83 ? XBoolean.S_TRUE : XBoolean.S_FALSE; 84 } 85 } 86 } 87 | Popular Tags |