com.nwalsh.saxon

Class UnwrapLinksEmitter


public class UnwrapLinksEmitter
extends CopyEmitter

Saxon extension to unwrap links in a result tree fragment.

$Id: UnwrapLinksEmitter.java 1731 2002-06-26 11:03:05Z nwalsh $

Copyright (C) 2000, 2002 Norman Walsh.

This class provides the guts of a Saxon 6.* implementation of a link unwrapper.

The general design is this: the stylesheets construct a result tree fragment for some environment. Then the result tree fragment is "replayed" through the UnwrapLinksEmitter; the UnwrapLinksEmitter builds a new result tree fragment from this event stream with top-level links unwrapped. That RTF is returned. Note that only a single level of unwrapping is performed. This is clearly a crude implementation.

Change Log:

Field Summary

protected Stack
elementStack
A stack for the preserving information about open elements.
protected boolean
foStylesheet
Is the stylesheet currently running an FO stylesheet?
protected static String
foURI
The FO namespace name.
protected int
htmlAFingerprint
protected boolean
inSkip
protected int
linkDepth
Are we currently in a link? How deep?
protected Stack
saveStack
protected int
skipDepth
protected boolean
tryAgain
protected static String
xhURI
The XHTML namespace name.
protected int
xhtmlAFingerprint

Fields inherited from class com.nwalsh.saxon.CopyEmitter

namePool, rtf, rtfEmitter

Constructor Summary

UnwrapLinksEmitter(Controller controller, NamePool namePool, boolean foStylesheet)
Constructor for the UnwrapLinksEmitter.

Method Summary

void
endElement(int nameCode)
Process end element events.
void
startElement(int nameCode, org.xml.sax.Attributes attributes, int[] namespaces, int nscount)
Process start element events.
boolean
tryAgain()

Methods inherited from class com.nwalsh.saxon.CopyEmitter

characters, comment, endDocument, endElement, getResultTreeFragment, processingInstruction, setDocumentLocator, setEscaping, setNamePool, setUnparsedEntity, setWriter, startDocument, startElement

Field Details

elementStack

protected Stack elementStack
A stack for the preserving information about open elements.

foStylesheet

protected boolean foStylesheet
Is the stylesheet currently running an FO stylesheet?

foURI

protected static String foURI
The FO namespace name.

htmlAFingerprint

protected int htmlAFingerprint

inSkip

protected boolean inSkip

linkDepth

protected int linkDepth
Are we currently in a link? How deep?

saveStack

protected Stack saveStack

skipDepth

protected int skipDepth

tryAgain

protected boolean tryAgain

xhURI

protected static String xhURI
The XHTML namespace name.

xhtmlAFingerprint

protected int xhtmlAFingerprint

Constructor Details

UnwrapLinksEmitter

public UnwrapLinksEmitter(Controller controller,
                          NamePool namePool,
                          boolean foStylesheet)
Constructor for the UnwrapLinksEmitter.
Parameters:
namePool - The name pool to use for constructing elements and attributes.
foStylesheet - Is this an FO stylesheet?

Method Details

endElement

public void endElement(int nameCode)
            throws TransformerException
Process end element events.
Overrides:
endElement in interface CopyEmitter

startElement

public void startElement(int nameCode,
                         org.xml.sax.Attributes attributes,
                         int[] namespaces,
                         int nscount)
            throws TransformerException
Process start element events.
Overrides:
startElement in interface CopyEmitter

tryAgain

public boolean tryAgain()
            throws TransformerException