19f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/*
29f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Licensed to the Apache Software Foundation (ASF) under one
39f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or more contributor license agreements. See the NOTICE file
49f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed with this work for additional information
59f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * regarding copyright ownership. The ASF licenses this file
69f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * to you under the Apache License, Version 2.0 (the  "License");
79f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * you may not use this file except in compliance with the License.
89f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * You may obtain a copy of the License at
99f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *
109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *     http://www.apache.org/licenses/LICENSE-2.0
119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *
129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Unless required by applicable law or agreed to in writing, software
139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS,
149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * See the License for the specific language governing permissions and
169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * limitations under the License.
179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/*
199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * $Id: ExpressionContext.java 468637 2006-10-28 06:51:02Z minchau $
209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpackage org.apache.xalan.extensions;
229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport javax.xml.transform.ErrorListener;
249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xpath.objects.XObject;
269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.w3c.dom.Node;
279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.w3c.dom.traversal.NodeIterator;
289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/**
309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * An object that implements this interface can supply
319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * information about the current XPath expression context.
329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpublic interface ExpressionContext
349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson{
359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Get the current context node.
389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return The current context node.
399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public Node getContextNode();
419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Get the current context node list.
449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return An iterator for the current context list, as
459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * defined in XSLT.
469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public NodeIterator getContextNodes();
489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Get the error listener.
519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return The registered error listener.
529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public ErrorListener getErrorListener();
549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Get the value of a node as a number.
579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param n Node to be converted to a number.  May be null.
589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return value of n as a number.
599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public double toNumber(Node n);
619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Get the value of a node as a string.
649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param n Node to be converted to a string.  May be null.
659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return value of n as a string, or an empty string if n is null.
669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public String toString(Node n);
689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Get a variable based on it's qualified name.
719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param qname The qualified name of the variable.
739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return The evaluated value of the variable.
759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws javax.xml.transform.TransformerException
779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public XObject getVariableOrParam(org.apache.xml.utils.QName qname)
799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            throws javax.xml.transform.TransformerException;
809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Get the XPathContext that owns this ExpressionContext.
839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Note: exslt:function requires the XPathContext to access
859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * the variable stack and TransformerImpl.
869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return The current XPathContext.
889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws javax.xml.transform.TransformerException
899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public org.apache.xpath.XPathContext getXPathContext()
919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            throws javax.xml.transform.TransformerException;
929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson}
94