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.Comment; 5 import net.sf.saxon.instruct.Executable; 6 import net.sf.saxon.om.AttributeCollection; 7 import net.sf.saxon.value.StringValue; 8 import net.sf.saxon.trans.XPathException; 9 10 import javax.xml.transform.TransformerConfigurationException ; 11 12 15 16 public final class XSLComment extends XSLStringConstructor { 17 18 public void prepareAttributes() throws XPathException { 19 20 String selectAtt = null; 21 22 AttributeCollection atts = getAttributeList(); 23 for (int a=0; a<atts.getLength(); a++) { 24 int nc = atts.getNameCode(a); 25 String f = getNamePool().getClarkName(nc); 26 if (f==StandardNames.SELECT) { 27 selectAtt = atts.getValue(a).trim(); 28 } else { 29 checkUnknownAttribute(nc); 30 } 31 } 32 33 if (selectAtt!=null) { 34 select = makeExpression(selectAtt); 35 } 36 } 37 38 public void validate() throws XPathException { 39 select = typeCheck("select", select); 40 checkWithinTemplate(); 41 super.validate(); 42 } 43 44 public Expression compile(Executable exec) throws XPathException { 45 Comment inst = new Comment(); 46 compileContent(exec, inst, StringValue.SINGLE_SPACE); 47 ExpressionTool.makeParentReferences(inst); 49 return inst; 50 } 51 52 } 53 | Popular Tags |