1 16 19 package org.apache.xpath.functions; 20 21 import org.apache.xml.dtm.DTM; 22 import org.apache.xml.dtm.DTMIterator; 23 import org.apache.xpath.XPathContext; 24 import org.apache.xpath.axes.LocPathIterator; 25 import org.apache.xpath.axes.PredicatedNodeTest; 26 import org.apache.xpath.objects.XNodeSet; 27 import org.apache.xpath.objects.XObject; 28 import org.apache.xpath.axes.SubContextList; 29 import org.apache.xpath.patterns.StepPattern; 30 import org.apache.xalan.res.XSLMessages; 31 import org.apache.xalan.res.XSLTErrorResources; 32 33 34 38 public class FuncCurrent extends Function 39 { 40 41 49 public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException 50 { 51 52 SubContextList subContextList = xctxt.getCurrentNodeList(); 53 int currentNode = DTM.NULL; 54 55 if (null != subContextList) { 56 if (subContextList instanceof PredicatedNodeTest) { 57 LocPathIterator iter = ((PredicatedNodeTest)subContextList) 58 .getLocPathIterator(); 59 currentNode = iter.getCurrentContextNode(); 60 } else if(subContextList instanceof StepPattern) { 61 throw new RuntimeException (XSLMessages.createMessage( 62 XSLTErrorResources.ER_PROCESSOR_ERROR,null)); 63 } 64 } else { 65 currentNode = xctxt.getContextNode(); 67 } 68 return new XNodeSet(currentNode, xctxt.getDTMManager()); 69 } 70 71 74 public void fixupVariables(java.util.Vector vars, int globalsSize) 75 { 76 } 78 79 } 80 | Popular Tags |