1 16 19 package org.apache.xalan.templates; 20 21 import org.apache.xml.utils.FastStringBuffer; 22 import org.apache.xpath.XPath; 23 import org.apache.xpath.XPathContext; 24 import org.apache.xpath.XPathFactory; 25 import org.apache.xpath.compiler.XPathParser; 26 import org.apache.xpath.objects.XObject; 27 28 32 public class AVTPartXPath extends AVTPart 33 { 34 35 39 private XPath m_xpath; 40 41 51 public void fixupVariables(java.util.Vector vars, int globalsSize) 52 { 53 m_xpath.fixupVariables(vars, globalsSize); 54 } 55 56 62 public boolean canTraverseOutsideSubtree() 63 { 64 return m_xpath.getExpression().canTraverseOutsideSubtree(); 65 } 66 67 72 public AVTPartXPath(XPath xpath) 73 { 74 m_xpath = xpath; 75 } 76 77 95 public AVTPartXPath( 96 String val, org.apache.xml.utils.PrefixResolver nsNode, 97 XPathParser xpathProcessor, XPathFactory factory, 98 XPathContext liaison) 99 throws javax.xml.transform.TransformerException 100 { 101 m_xpath = new XPath(val, null, nsNode, XPath.SELECT, liaison.getErrorListener()); 102 } 103 104 109 public String getSimpleString() 110 { 111 return "{" + m_xpath.getPatternString() + "}"; 112 } 113 114 128 public void evaluate( 129 XPathContext xctxt, FastStringBuffer buf, int context, org.apache.xml.utils.PrefixResolver nsNode) 130 throws javax.xml.transform.TransformerException 131 { 132 133 XObject xobj = m_xpath.execute(xctxt, context, nsNode); 134 135 if (null != xobj) 136 { 137 xobj.appendToFsb(buf); 138 } 139 } 140 141 144 public void callVisitors(XSLTVisitor visitor) 145 { 146 m_xpath.getExpression().callVisitors(m_xpath, visitor); 147 } 148 } 149 | Popular Tags |