1 package net.sf.saxon.style; 2 import net.sf.saxon.expr.Expression; 3 import net.sf.saxon.instruct.Executable; 4 import net.sf.saxon.om.AttributeCollection; 5 import net.sf.saxon.trans.XPathException; 6 import net.sf.saxon.type.ItemType; 7 8 9 13 14 public class XSLWhen extends StyleElement { 15 16 private Expression test; 17 18 public Expression getCondition() { 19 return test; 20 } 21 22 27 28 protected ItemType getReturnedItemType() { 29 return getCommonChildItemType(); 30 } 31 32 public void prepareAttributes() throws XPathException { 33 String testAtt=null; 34 35 AttributeCollection atts = getAttributeList(); 36 37 for (int a=0; a<atts.getLength(); a++) { 38 int nc = atts.getNameCode(a); 39 String f = getNamePool().getClarkName(nc); 40 if (f==StandardNames.TEST) { 41 testAtt = atts.getValue(a); 42 } else { 43 checkUnknownAttribute(nc); 44 } 45 } 46 47 if (testAtt==null) { 48 reportAbsence("test"); 49 } else { 50 test = makeExpression(testAtt); 51 } 52 } 53 54 58 59 public boolean mayContainSequenceConstructor() { 60 return true; 61 } 62 63 public void validate() throws XPathException { 64 if (!(getParent() instanceof XSLChoose)) { 65 compileError("xsl:when must be immediately within xsl:choose", "XTSE0010"); 66 } 67 test = typeCheck("test", test); 68 } 69 70 73 74 public void markTailCalls() { 75 StyleElement last = getLastChildInstruction(); 76 if (last != null) { 77 last.markTailCalls(); 78 } 79 } 80 81 public Expression compile(Executable exec) throws XPathException { 82 return null; 83 } 85 86 } 87 88 | Popular Tags |