net.sf.saxon.style
Class StylesheetStripper
java.lang.Object
net.sf.saxon.event.SequenceReceiver
net.sf.saxon.event.ProxyReceiver
net.sf.saxon.event.Stripper
net.sf.saxon.style.StylesheetStripper
- All Implemented Interfaces:
- javax.xml.transform.Result, Receiver
public class StylesheetStripper
- extends Stripper
The StylesheetStripper refines the Stripper class to do stripping of
whitespace nodes on a stylesheet. This is handled specially (a) because
it is done at compile time, so there is no Controller available, and (b)
because the rules are very simple
- Author:
- Michael H. Kay
Fields inherited from interface javax.xml.transform.Result |
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING |
Method Summary |
void |
characters(java.lang.CharSequence chars,
int locationId,
int properties)
Handle a text node |
Stripper |
getAnother()
Get a clean copy of this stripper |
byte |
isSpacePreserving(int nameCode)
Decide whether an element is in the set of white-space preserving element types |
byte |
isSpacePreserving(NodeInfo element)
Decide whether an element is in the set of white-space preserving element types. |
void |
setStylesheetRules(NamePool namePool)
Set the rules appropriate for whitespace-stripping in a stylesheet |
Methods inherited from class net.sf.saxon.event.ProxyReceiver |
close, comment, endDocument, getConfiguration, getDocumentLocator, getNamePool, getSystemId, getUnderlyingReceiver, namespace, processingInstruction, setSystemId, setUnderlyingReceiver, setUnparsedEntity, startContent, startDocument |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StylesheetStripper
public StylesheetStripper()
getAnother
public Stripper getAnother()
- Description copied from class:
Stripper
- Get a clean copy of this stripper
- Overrides:
getAnother
in class Stripper
setStylesheetRules
public void setStylesheetRules(NamePool namePool)
- Set the rules appropriate for whitespace-stripping in a stylesheet
isSpacePreserving
public byte isSpacePreserving(int nameCode)
- Decide whether an element is in the set of white-space preserving element types
- Overrides:
isSpacePreserving
in class Stripper
- Parameters:
nameCode
- identifies the element being tested
- Returns:
- ALWAYS_PRESERVE if the element is in the set of white-space preserving
element types, ALWAYS_STRIP if the element is to be stripped regardless of the
xml:space setting, and STRIP_DEFAULT otherwise
isSpacePreserving
public byte isSpacePreserving(NodeInfo element)
- Decide whether an element is in the set of white-space preserving element types.
This version of the method is useful in cases where getting the namecode of the
element is potentially expensive, e.g. with DOM nodes.
- Overrides:
isSpacePreserving
in class Stripper
- Parameters:
element
- Identifies the element whose whitespace is possibly to
be preserved
- Returns:
- true if the element is in the set of white-space preserving element types
characters
public void characters(java.lang.CharSequence chars,
int locationId,
int properties)
throws XPathException
- Handle a text node
- Specified by:
characters
in interface Receiver
- Overrides:
characters
in class Stripper
- Parameters:
chars
- The characterslocationId
- an integer which can be interpreted using a LocationMap to return
information such as line number and system ID. If no location information is available,
the value zero is supplied.properties
- Bit significant value. The following bits are defined:
- DISABLE_ESCAPING
- Disable escaping for this text node
- USE_CDATA
- Output as a CDATA section
- NO_SPECIAL_CHARACTERS
- Value contains no special characters
- WHITESPACE
- Text is all whitespace
- Throws:
XPathException