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 13 14 public class SAXONWhile extends StyleElement { 15 16 private Expression test; 17 18 22 23 public boolean isInstruction() { 24 return true; 25 } 26 27 31 32 public boolean mayContainTemplateBody() { 33 return true; 34 } 35 36 public void prepareAttributes() throws TransformerConfigurationException { 37 38 String testAtt=null; 39 40 StandardNames sn = getStandardNames(); 41 AttributeCollection atts = getAttributeList(); 42 43 for (int a=0; a<atts.getLength(); a++) { 44 int nc = atts.getNameCode(a); 45 int f = nc & 0xfffff; 46 if (f==sn.NAME) { 47 } else if (f==sn.TEST) { 49 testAtt = atts.getValue(a); 50 } else { 51 checkUnknownAttribute(nc); 52 } 53 } 54 55 if (testAtt==null) { 56 reportAbsence("test"); 57 return; 58 } 59 test = makeExpression(testAtt); 60 } 61 62 public void validate() throws TransformerConfigurationException { 63 checkWithinTemplate(); 64 } 66 67 public void process(Context context) throws TransformerException 68 { 69 while (test.evaluateAsBoolean(context)) { 70 processChildren(context); 71 } 72 } 73 74 } 75 76 | Popular Tags |