Top Description Inners Fields Constructors Methods
uk.ac.ed.ph.snuggletex.utilities

public final Class MathMLDownConverter

extends Object
Class Inheritance
Imports
org.w3c.dom.Document, .Element, uk.ac.ed.ph.snuggletex.DOMOutputOptions, .SnuggleConstants, .SnuggleRuntimeException, uk.ac.ed.ph.snuggletex.definitions.Globals, uk.ac.ed.ph.snuggletex.internal.util.XMLUtilities, javax.xml.transform.Source, .Templates, .Transformer, .URIResolver, javax.xml.transform.dom.DOMResult, .DOMSource, java.util.Map.Entry, .Properties

This utility class "down-converts" a DOM Document so that simple MathML expressions are replaced by XHTML + CSS alternatives.

More complex MathML expressions are left as-is.

This can be used independently of SnuggleTeX if required; you may want to instantiate and provide your own StylesheetCache in this case if you already do things with XSLT.

Author
David McKain
Version
$Revision$

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
MathMLDownConverter.CSSPropertiesURIResolver

Trivial URIResolver that returns an XML Document corresponding to the current session's CSS Properties when the URI Globals#CSS_PROPERTIES_DOCUMENT_URN is used.

Field Summary

Modifier and TypeField and Description
private final Properties
private final StylesheetManager

Constructor Summary

AccessConstructor and Description
public
public
MathMLDownConverter(final Properties cssProperties)

public
MathMLDownConverter(final StylesheetCache stylesheetCache)

public
MathMLDownConverter(final StylesheetManager stylesheetManager, final DOMOutputOptions options)

Creates a new MathMLDownConverter which will inline CSS properties if specified by the given DOMOutputOptions.

public
MathMLDownConverter(final StylesheetManager stylesheetManager, final Properties cssProperties)

Method Summary

Modifier and TypeMethod and Description
public void
buildCSSPropertiesDocument(Document result, Properties cssProperties)

Converts the CSS Properties specified within the DOMOutputOptions into an XML document of the form:

<properties xmlns="http;//www.ph.ed.ac.uk/snuggletex">
  <property name="..." value="..."/>
  ...
public Document
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cssPropertiesback to summary
private final Properties cssProperties
stylesheetManagerback to summary
private final StylesheetManager stylesheetManager

Constructor Detail

MathMLDownConverterback to summary
public MathMLDownConverter()
MathMLDownConverterback to summary
public MathMLDownConverter(final Properties cssProperties)
MathMLDownConverterback to summary
public MathMLDownConverter(final StylesheetCache stylesheetCache)
MathMLDownConverterback to summary
public MathMLDownConverter(final StylesheetManager stylesheetManager, final DOMOutputOptions options)

Creates a new MathMLDownConverter which will inline CSS properties if specified by the given DOMOutputOptions.

MathMLDownConverterback to summary
public MathMLDownConverter(final StylesheetManager stylesheetManager, final Properties cssProperties)

Method Detail

buildCSSPropertiesDocumentback to summary
public void buildCSSPropertiesDocument(Document result, Properties cssProperties)

Converts the CSS Properties specified within the DOMOutputOptions into an XML document of the form:

<properties xmlns="http;//www.ph.ed.ac.uk/snuggletex">
  <property name="..." value="..."/>
  ...
</properties>
downConvertDOMback to summary
public Document downConvertDOM(Document document)
uk.ac.ed.ph.snuggletex.utilities back to summary

protected final Class MathMLDownConverter.CSSPropertiesURIResolver

extends Object
implements URIResolver
Class Inheritance
  • java.lang.Object
  • uk.ac.ed.ph.snuggletex.utilities.MathMLDownConverter.CSSPropertiesURIResolver
All Implemented Interfaces
javax.xml.transform.URIResolver

Trivial URIResolver that returns an XML Document corresponding to the current session's CSS Properties when the URI Globals#CSS_PROPERTIES_DOCUMENT_URN is used.

Field Summary

Modifier and TypeField and Description
private final Source

Constructor Summary

AccessConstructor and Description
public
CSSPropertiesURIResolver(final Document cssPropertiesDocument)

Method Summary

Modifier and TypeMethod and Description
public Source
resolve(String href, String base)

Implements javax.xml.transform.URIResolver.resolve.

Called by the processor when it encounters an xsl:include, xsl:import, or document() function.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cssPropertiesSourceback to summary
private final Source cssPropertiesSource

Constructor Detail

CSSPropertiesURIResolverback to summary
public CSSPropertiesURIResolver(final Document cssPropertiesDocument)

Method Detail

resolveback to summary
public Source resolve(String href, String base)

Implements javax.xml.transform.URIResolver.resolve.

Doc from javax.xml.transform.URIResolver.resolve.

Called by the processor when it encounters an xsl:include, xsl:import, or document() function.