1 package com.icl.saxon.style; 2 import com.icl.saxon.tree.AttributeCollection; 3 import com.icl.saxon.Context; 4 5 6 import com.icl.saxon.output.Outputter; 7 import javax.xml.transform.TransformerException ; 8 import javax.xml.transform.TransformerConfigurationException ; 9 11 14 15 public final class XSLComment extends XSLStringConstructor { 16 17 public void prepareAttributes() throws TransformerConfigurationException { 18 AttributeCollection atts = getAttributeList(); 19 for (int a=0; a<atts.getLength(); a++) { 20 int nc = atts.getNameCode(a); 21 checkUnknownAttribute(nc); 22 } 23 } 24 25 public void validate() throws TransformerConfigurationException { 26 checkWithinTemplate(); 27 optimize(); 28 } 29 30 public void process(Context context) throws TransformerException 31 { 32 String comment = expandChildren(context); 33 34 while(true) { 36 int hh = comment.indexOf("--"); 37 if (hh < 0) break; 38 context.getController().reportRecoverableError("Invalid characters (--) in comment", this); 39 comment = comment.substring(0, hh+1) + " " + comment.substring(hh+1); 40 } 41 if (comment.length()>0 && comment.charAt(comment.length()-1)=='-') { 42 context.getController().reportRecoverableError("Invalid character (-) at end of comment", this); 43 comment = comment + " "; 44 } 45 context.getOutputter().writeComment(comment); 46 } 47 48 } 49 | Popular Tags |