Search in sources :

Example 6 with SubContextList

use of org.apache.xpath.axes.SubContextList in project robovm by robovm.

the class FuncLast method getCountOfContextNodeList.

/**
   * Get the position in the current context node list.
   *
   * @param xctxt non-null reference to XPath runtime context.
   *
   * @return The number of nodes in the list.
   *
   * @throws javax.xml.transform.TransformerException
   */
public int getCountOfContextNodeList(XPathContext xctxt) throws javax.xml.transform.TransformerException {
    // assert(null != m_contextNodeList, "m_contextNodeList must be non-null");
    // If we're in a predicate, then this will return non-null.
    SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();
    // System.out.println("iter: "+iter);
    if (null != iter)
        return iter.getLastPos(xctxt);
    DTMIterator cnl = xctxt.getContextNodeList();
    int count;
    if (null != cnl) {
        count = cnl.getLength();
    // System.out.println("count: "+count); 
    } else
        count = 0;
    return count;
}
Also used : SubContextList(org.apache.xpath.axes.SubContextList) DTMIterator(org.apache.xml.dtm.DTMIterator)

Aggregations

SubContextList (org.apache.xpath.axes.SubContextList)6 DTMIterator (org.apache.xml.dtm.DTMIterator)4 LocPathIterator (org.apache.xpath.axes.LocPathIterator)2 PredicatedNodeTest (org.apache.xpath.axes.PredicatedNodeTest)2 XNodeSet (org.apache.xpath.objects.XNodeSet)2 StepPattern (org.apache.xpath.patterns.StepPattern)2