Search in sources :

Example 6 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)

Example 7 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 8 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 9 with ElemVariable

use of org.apache.xalan.templates.ElemVariable in project robovm by robovm.

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 10 with ElemVariable

use of org.apache.xalan.templates.ElemVariable in project robovm by robovm.

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)

Aggregations

ElemVariable (org.apache.xalan.templates.ElemVariable)10 ElemParam (org.apache.xalan.templates.ElemParam)5 ElemTemplateElement (org.apache.xalan.templates.ElemTemplateElement)5 ElemExsltFuncResult (org.apache.xalan.templates.ElemExsltFuncResult)4 ElemExsltFunction (org.apache.xalan.templates.ElemExsltFunction)4 Vector (java.util.Vector)2 ElemMessage (org.apache.xalan.templates.ElemMessage)2 StylesheetRoot (org.apache.xalan.templates.StylesheetRoot)2 XUnresolvedVariable (org.apache.xalan.templates.XUnresolvedVariable)2 NodeVector (org.apache.xml.utils.NodeVector)2 VariableStack (org.apache.xpath.VariableStack)2 XPathContext (org.apache.xpath.XPathContext)2 XObject (org.apache.xpath.objects.XObject)2 Debugger (org.intellij.plugins.xsltDebugger.rt.engine.Debugger)2 SAXException (org.xml.sax.SAXException)2 TransformerException (javax.xml.transform.TransformerException)1 Value (org.intellij.plugins.xsltDebugger.rt.engine.Value)1 VariableImpl (org.intellij.plugins.xsltDebugger.rt.engine.local.VariableImpl)1