1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /* 6 * Copyright 1999-2004 The Apache Software Foundation. 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 /* 21 * $Id: ExpressionContext.java,v 1.2.4.1 2005/09/10 19:34:03 jeffsuttor Exp $ 22 */ 23 package com.sun.org.apache.xalan.internal.extensions; 24 25 import javax.xml.transform.ErrorListener; 26 27 import com.sun.org.apache.xpath.internal.objects.XObject; 28 import org.w3c.dom.Node; 29 import org.w3c.dom.traversal.NodeIterator; 30 31 /** 32 * An object that implements this interface can supply 33 * information about the current XPath expression context. 34 */ 35 public interface ExpressionContext 36 { 37 38 /** 39 * Get the current context node. 40 * @return The current context node. 41 */ getContextNode()42 public Node getContextNode(); 43 44 /** 45 * Get the current context node list. 46 * @return An iterator for the current context list, as 47 * defined in XSLT. 48 */ getContextNodes()49 public NodeIterator getContextNodes(); 50 51 /** 52 * Get the error listener. 53 * @return The registered error listener. 54 */ getErrorListener()55 public ErrorListener getErrorListener(); 56 57 /** 58 * Get the value of a node as a number. 59 * @param n Node to be converted to a number. May be null. 60 * @return value of n as a number. 61 */ toNumber(Node n)62 public double toNumber(Node n); 63 64 /** 65 * Get the value of a node as a string. 66 * @param n Node to be converted to a string. May be null. 67 * @return value of n as a string, or an empty string if n is null. 68 */ toString(Node n)69 public String toString(Node n); 70 71 /** 72 * Get a variable based on it's qualified name. 73 * 74 * @param qname The qualified name of the variable. 75 * 76 * @return The evaluated value of the variable. 77 * 78 * @throws javax.xml.transform.TransformerException 79 */ getVariableOrParam(com.sun.org.apache.xml.internal.utils.QName qname)80 public XObject getVariableOrParam(com.sun.org.apache.xml.internal.utils.QName qname) 81 throws javax.xml.transform.TransformerException; 82 83 /** 84 * Get the XPathContext that owns this ExpressionContext. 85 * 86 * Note: exslt:function requires the XPathContext to access 87 * the variable stack and TransformerImpl. 88 * 89 * @return The current XPathContext. 90 * @throws javax.xml.transform.TransformerException 91 */ getXPathContext()92 public com.sun.org.apache.xpath.internal.XPathContext getXPathContext() 93 throws javax.xml.transform.TransformerException; 94 95 } 96