Search in sources :

Example 11 with ElemVariable

use of org.apache.xalan.templates.ElemVariable in project j2objc by google.

the class ProcessorExsltFunction method ancestorIsOk.

/**
 * Verify that a literal result belongs to a result element, a variable,
 * or a parameter.
 */
boolean ancestorIsOk(ElemTemplateElement child) {
    while (child.getParentElem() != null && !(child.getParentElem() instanceof ElemExsltFunction)) {
        ElemTemplateElement parent = child.getParentElem();
        if (parent instanceof ElemExsltFuncResult || parent instanceof ElemVariable || parent instanceof ElemParam || parent instanceof ElemMessage)
            return true;
        child = parent;
    }
    return false;
}
Also used : ElemVariable(org.apache.xalan.templates.ElemVariable) ElemExsltFuncResult(org.apache.xalan.templates.ElemExsltFuncResult) ElemParam(org.apache.xalan.templates.ElemParam) ElemMessage(org.apache.xalan.templates.ElemMessage) ElemExsltFunction(org.apache.xalan.templates.ElemExsltFunction) ElemTemplateElement(org.apache.xalan.templates.ElemTemplateElement)

Example 12 with ElemVariable

use of org.apache.xalan.templates.ElemVariable in project j2objc by google.

the class ProcessorGlobalVariableDecl method endElement.

/**
 * Receive notification of the end of an element.
 *
 * @param name The element type name.
 * @param attributes The specified or defaulted attributes.
 *
 * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
 * @param uri The Namespace URI, or an empty string.
 * @param localName The local name (without prefix), or empty string if not namespace processing.
 * @param rawName The qualified name (with prefix).
 */
public void endElement(StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException {
    ElemVariable v = (ElemVariable) handler.getElemTemplateElement();
    handler.getStylesheet().appendChild(v);
    handler.getStylesheet().setVariable(v);
    super.endElement(handler, uri, localName, rawName);
}
Also used : ElemVariable(org.apache.xalan.templates.ElemVariable)

Example 13 with ElemVariable

use of org.apache.xalan.templates.ElemVariable in project j2objc by google.

the class ProcessorExsltFuncResult method startElement.

/**
 * Verify that the func:result element does not appear within a variable,
 * parameter, or another func:result, and that it belongs to a func:function
 * element.
 */
public void startElement(StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws SAXException {
    String msg = "";
    super.startElement(handler, uri, localName, rawName, attributes);
    ElemTemplateElement ancestor = handler.getElemTemplateElement().getParentElem();
    while (ancestor != null && !(ancestor instanceof ElemExsltFunction)) {
        if (ancestor instanceof ElemVariable || ancestor instanceof ElemParam || ancestor instanceof ElemExsltFuncResult) {
            msg = "func:result cannot appear within a variable, parameter, or another func:result.";
            handler.error(msg, new SAXException(msg));
        }
        ancestor = ancestor.getParentElem();
    }
    if (ancestor == null) {
        msg = "func:result must appear in a func:function element";
        handler.error(msg, new SAXException(msg));
    }
}
Also used : ElemVariable(org.apache.xalan.templates.ElemVariable) ElemExsltFuncResult(org.apache.xalan.templates.ElemExsltFuncResult) ElemParam(org.apache.xalan.templates.ElemParam) ElemExsltFunction(org.apache.xalan.templates.ElemExsltFunction) ElemTemplateElement(org.apache.xalan.templates.ElemTemplateElement) SAXException(org.xml.sax.SAXException)

Aggregations

ElemVariable (org.apache.xalan.templates.ElemVariable)13 ElemTemplateElement (org.apache.xalan.templates.ElemTemplateElement)6 ElemParam (org.apache.xalan.templates.ElemParam)5 Vector (java.util.Vector)4 ElemExsltFuncResult (org.apache.xalan.templates.ElemExsltFuncResult)4 ElemExsltFunction (org.apache.xalan.templates.ElemExsltFunction)4 StylesheetRoot (org.apache.xalan.templates.StylesheetRoot)4 VariableStack (org.apache.xpath.VariableStack)4 NodeVector (org.apache.xml.utils.NodeVector)3 XObject (org.apache.xpath.objects.XObject)3 ElemMessage (org.apache.xalan.templates.ElemMessage)2 XUnresolvedVariable (org.apache.xalan.templates.XUnresolvedVariable)2 XPathContext (org.apache.xpath.XPathContext)2 Debugger (org.intellij.plugins.xsltDebugger.rt.engine.Debugger)2 SAXException (org.xml.sax.SAXException)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 TransformerException (javax.xml.transform.TransformerException)1 TracerEvent (org.apache.xalan.trace.TracerEvent)1 QName (org.apache.xml.utils.QName)1