1 package com.icl.saxon.style; 2 import com.icl.saxon.tree.AttributeCollection; 3 import com.icl.saxon.*; 4 import com.icl.saxon.expr.*; 5 import javax.xml.transform.*; 6 7 8 12 13 public class XSLWhen extends StyleElement { 14 15 private Expression test; 16 17 public Expression getCondition() { 18 return test; 19 } 20 21 25 26 public boolean doesPostProcessing() { 27 return false; 28 } 29 30 public void prepareAttributes() throws TransformerConfigurationException { 31 String testAtt=null; 32 33 StandardNames sn = getStandardNames(); 34 AttributeCollection atts = getAttributeList(); 35 36 for (int a=0; a<atts.getLength(); a++) { 37 int nc = atts.getNameCode(a); 38 int f = nc & 0xfffff; 39 if (f==sn.NAME) { 40 } else if (f==sn.TEST) { 42 testAtt = atts.getValue(a); 43 } else { 44 checkUnknownAttribute(nc); 45 } 46 } 47 48 if (testAtt==null) { 49 reportAbsence("test"); 50 } else { 51 test = makeExpression(testAtt); 52 } 53 } 54 55 59 60 public boolean mayContainTemplateBody() { 61 return true; 62 } 63 64 public void validate() throws TransformerConfigurationException { 65 if (!(getParentNode() instanceof XSLChoose)) { 66 compileError("xsl:when must be immediately within xsl:choose"); 67 } 68 } 69 70 public void process(Context context) throws TransformerException 71 { 72 processChildren(context); } 74 75 } 76 77 | Popular Tags |