1 16 19 package com.sun.org.apache.xpath.internal.functions; 20 21 import com.sun.org.apache.xml.internal.dtm.DTM; 22 import com.sun.org.apache.xml.internal.dtm.DTMIterator; 23 import com.sun.org.apache.xpath.internal.XPathContext; 24 import com.sun.org.apache.xpath.internal.axes.LocPathIterator; 25 import com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest; 26 import com.sun.org.apache.xpath.internal.objects.XNodeSet; 27 import com.sun.org.apache.xpath.internal.objects.XObject; 28 import com.sun.org.apache.xpath.internal.axes.SubContextList; 29 import com.sun.org.apache.xpath.internal.patterns.StepPattern; 30 import com.sun.org.apache.xalan.internal.res.XSLMessages; 31 import com.sun.org.apache.xalan.internal.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 |