Search in sources :

Example 1 with XRTreeFrag

use of org.apache.xpath.objects.XRTreeFrag in project robovm by robovm.

the class ElemVariable method getValue.

/**
   * Get the XObject representation of the variable.
   *
   * @param transformer non-null reference to the the current transform-time state.
   * @param sourceNode non-null reference to the <a href="http://www.w3.org/TR/xslt#dt-current-node">current source node</a>.
   *
   * @return the XObject representation of the variable.
   *
   * @throws TransformerException
   */
public XObject getValue(TransformerImpl transformer, int sourceNode) throws TransformerException {
    XObject var;
    XPathContext xctxt = transformer.getXPathContext();
    xctxt.pushCurrentNode(sourceNode);
    try {
        if (null != m_selectPattern) {
            var = m_selectPattern.execute(xctxt, sourceNode, this);
            var.allowDetachToRelease(false);
        } else if (null == getFirstChildElem()) {
            var = XString.EMPTYSTRING;
        } else {
            // Use result tree fragment.
            // Global variables may be deferred (see XUnresolvedVariable) and hence
            // need to be assigned to a different set of DTMs than local variables
            // so they aren't popped off the stack on return from a template.
            int df;
            ////// problem in parameters. Needs more study.
            try {
                //////////xctxt.getVarStack().link(0);
                if (// Global variable
                m_parentNode instanceof Stylesheet)
                    df = transformer.transformToGlobalRTF(this);
                else
                    df = transformer.transformToRTF(this);
            } finally {
            //////////////xctxt.getVarStack().unlink(); 
            }
            var = new XRTreeFrag(df, xctxt, this);
        }
    } finally {
        xctxt.popCurrentNode();
    }
    return var;
}
Also used : XRTreeFrag(org.apache.xpath.objects.XRTreeFrag) XPathContext(org.apache.xpath.XPathContext) XObject(org.apache.xpath.objects.XObject)

Example 2 with XRTreeFrag

use of org.apache.xpath.objects.XRTreeFrag in project robovm by robovm.

the class ElemWithParam method getValue.

/**
   * Get the XObject representation of the variable.
   *
   * @param transformer non-null reference to the the current transform-time state.
   * @param sourceNode non-null reference to the <a href="http://www.w3.org/TR/xslt#dt-current-node">current source node</a>.
   *
   * @return the XObject representation of the variable.
   *
   * @throws TransformerException
   */
public XObject getValue(TransformerImpl transformer, int sourceNode) throws TransformerException {
    XObject var;
    XPathContext xctxt = transformer.getXPathContext();
    xctxt.pushCurrentNode(sourceNode);
    try {
        if (null != m_selectPattern) {
            var = m_selectPattern.execute(xctxt, sourceNode, this);
            var.allowDetachToRelease(false);
        } else if (null == getFirstChildElem()) {
            var = XString.EMPTYSTRING;
        } else {
            // Use result tree fragment
            int df = transformer.transformToRTF(this);
            var = new XRTreeFrag(df, xctxt, this);
        }
    } finally {
        xctxt.popCurrentNode();
    }
    return var;
}
Also used : XRTreeFrag(org.apache.xpath.objects.XRTreeFrag) XPathContext(org.apache.xpath.XPathContext) XObject(org.apache.xpath.objects.XObject)

Example 3 with XRTreeFrag

use of org.apache.xpath.objects.XRTreeFrag in project j2objc by google.

the class ElemVariable method getValue.

/**
   * Get the XObject representation of the variable.
   *
   * @param transformer non-null reference to the the current transform-time state.
   * @param sourceNode non-null reference to the <a href="http://www.w3.org/TR/xslt#dt-current-node">current source node</a>.
   *
   * @return the XObject representation of the variable.
   *
   * @throws TransformerException
   */
public XObject getValue(TransformerImpl transformer, int sourceNode) throws TransformerException {
    XObject var;
    XPathContext xctxt = transformer.getXPathContext();
    xctxt.pushCurrentNode(sourceNode);
    try {
        if (null != m_selectPattern) {
            var = m_selectPattern.execute(xctxt, sourceNode, this);
            var.allowDetachToRelease(false);
        } else if (null == getFirstChildElem()) {
            var = XString.EMPTYSTRING;
        } else {
            // Use result tree fragment.
            // Global variables may be deferred (see XUnresolvedVariable) and hence
            // need to be assigned to a different set of DTMs than local variables
            // so they aren't popped off the stack on return from a template.
            int df;
            ////// problem in parameters. Needs more study.
            try {
                //////////xctxt.getVarStack().link(0);
                if (// Global variable
                m_parentNode instanceof Stylesheet)
                    df = transformer.transformToGlobalRTF(this);
                else
                    df = transformer.transformToRTF(this);
            } finally {
            //////////////xctxt.getVarStack().unlink(); 
            }
            var = new XRTreeFrag(df, xctxt, this);
        }
    } finally {
        xctxt.popCurrentNode();
    }
    return var;
}
Also used : XRTreeFrag(org.apache.xpath.objects.XRTreeFrag) XPathContext(org.apache.xpath.XPathContext) XObject(org.apache.xpath.objects.XObject)

Example 4 with XRTreeFrag

use of org.apache.xpath.objects.XRTreeFrag in project j2objc by google.

the class ElemWithParam method getValue.

/**
   * Get the XObject representation of the variable.
   *
   * @param transformer non-null reference to the the current transform-time state.
   * @param sourceNode non-null reference to the <a href="http://www.w3.org/TR/xslt#dt-current-node">current source node</a>.
   *
   * @return the XObject representation of the variable.
   *
   * @throws TransformerException
   */
public XObject getValue(TransformerImpl transformer, int sourceNode) throws TransformerException {
    XObject var;
    XPathContext xctxt = transformer.getXPathContext();
    xctxt.pushCurrentNode(sourceNode);
    try {
        if (null != m_selectPattern) {
            var = m_selectPattern.execute(xctxt, sourceNode, this);
            var.allowDetachToRelease(false);
        } else if (null == getFirstChildElem()) {
            var = XString.EMPTYSTRING;
        } else {
            // Use result tree fragment
            int df = transformer.transformToRTF(this);
            var = new XRTreeFrag(df, xctxt, this);
        }
    } finally {
        xctxt.popCurrentNode();
    }
    return var;
}
Also used : XRTreeFrag(org.apache.xpath.objects.XRTreeFrag) XPathContext(org.apache.xpath.XPathContext) XObject(org.apache.xpath.objects.XObject)

Aggregations

XPathContext (org.apache.xpath.XPathContext)4 XObject (org.apache.xpath.objects.XObject)4 XRTreeFrag (org.apache.xpath.objects.XRTreeFrag)4