1 package net.sf.saxon.style; 2 import net.sf.saxon.event.Stripper; 3 import net.sf.saxon.om.NamePool; 4 import net.sf.saxon.om.NodeInfo; 5 import net.sf.saxon.trans.XPathException; 6 7 import java.util.Arrays ; 8 9 16 17 public class StylesheetStripper extends Stripper 18 { 19 20 21 25 private static final int[] specials = { 26 StandardNames.XSL_ANALYZE_STRING, 27 StandardNames.XSL_APPLY_IMPORTS, 28 StandardNames.XSL_APPLY_TEMPLATES, 29 StandardNames.XSL_ATTRIBUTE_SET, 30 StandardNames.XSL_CALL_TEMPLATE, 31 StandardNames.XSL_CHARACTER_MAP, 32 StandardNames.XSL_CHOOSE, 33 StandardNames.XSL_NEXT_MATCH, 34 StandardNames.XSL_STYLESHEET, 35 StandardNames.XSL_TRANSFORM 36 }; 37 38 public Stripper getAnother() { 39 StylesheetStripper s = new StylesheetStripper(); 40 return s; 41 } 42 43 46 47 public void setStylesheetRules(NamePool namePool) { 48 } 60 61 65 66 public byte isSpacePreserving(int nameCode) { 67 int fp = nameCode & 0xfffff; 68 if (fp == StandardNames.XSL_TEXT) { 69 return ALWAYS_PRESERVE; 70 }; 71 72 if (Arrays.binarySearch(specials, fp) >= 0) { 73 return ALWAYS_STRIP; 74 } 75 return STRIP_DEFAULT; 81 } 82 83 91 92 public byte isSpacePreserving(NodeInfo element) { 93 return isSpacePreserving(element.getNameCode()); 94 } 95 96 99 100 public void characters (CharSequence chars, int locationId, int properties) throws XPathException { 101 super.characters(chars, locationId, properties); 103 } 104 105 106 } 108 | Popular Tags |