1 package net.sf.saxon.style; 2 import net.sf.saxon.expr.Expression; 3 import net.sf.saxon.expr.ExpressionTool; 4 import net.sf.saxon.instruct.Executable; 5 import net.sf.saxon.instruct.WithParam; 6 import net.sf.saxon.om.Axis; 7 import net.sf.saxon.om.AxisIterator; 8 import net.sf.saxon.om.Item; 9 import net.sf.saxon.trans.XPathException; 10 11 15 16 public class XSLWithParam extends XSLGeneralVariable { 17 18 protected boolean allowsAsAttribute() { 19 return true; 20 } 21 22 protected boolean allowsTunnelAttribute() { 23 return true; 24 } 25 26 public void validate() throws XPathException { 27 super.validate(); 28 29 31 AxisIterator iter = iterateAxis(Axis.PRECEDING_SIBLING); 32 while (true) { 33 Item prev = iter.next(); 34 if (prev == null) { 35 break; 36 } 37 if (prev instanceof XSLWithParam) { 38 if (this.getVariableFingerprint() == ((XSLWithParam)prev).getVariableFingerprint()) { 39 compileError("Duplicate parameter name", "XTSE0670"); 40 } 41 } 42 } 43 44 } 45 46 public Expression compile(Executable exec) throws XPathException { 47 WithParam inst = new WithParam(); 48 inst.adoptChildExpression(select); 49 initializeInstruction(exec, inst); 50 ExpressionTool.makeParentReferences(inst); 51 return inst; 52 } 53 54 } 55 56 | Popular Tags |