com.jclark.xsl.tr

Class SheetImpl

Implemented Interfaces:
LoadContext, NamespaceConstants, Sheet, SheetDetails

(package private) class SheetImpl
extends java.lang.Object
implements SheetDetails, LoadContext, NamespaceConstants

Actually does the work of compiling the stylesheet's object model into the template rules, actions, variable definitions, etc. The constructor compiles the stylesheet, the method "process()" runs the transformation

Field Summary

(package private) Name
ATTRIBUTE
(package private) Name
CASE_ORDER
(package private) Name
CDATA_SECTION_ELEMENTS
(package private) Name
COUNT
(package private) Name
DATA_TYPE
(package private) Name
DEFAULT
(package private) Name
DISABLE_OUTPUT_ESCAPING
(package private) Name
DOCTYPE_PUBLIC
(package private) Name
DOCTYPE_SYSTEM
(package private) Name
ELEMENTS
(package private) Name
ENCODING
(package private) Name
EXCLUDE_RESULT_PREFIXES
(package private) Name
FORMAT
(package private) Name
FROM
(package private) Name
GROUPING_SEPARATOR
(package private) Name
GROUPING_SIZE
(package private) Name
HREF
(package private) Name
INDENT
(package private) Name
LANG
(package private) Name
LETTER_VALUE
(package private) Name
LEVEL
(package private) Name
MATCH
(package private) Name
MEDIA_TYPE
(package private) Name
METHOD
(package private) Name
MODE
(package private) Name
NAME
(package private) Name
NAMESPACE
(package private) Name
OMIT_XML_DECLARATION
(package private) Name
ORDER
(package private) Name
PRIORITY
(package private) Name
RESULT_PREFIX
(package private) Name
SELECT
(package private) Name
STANDALONE
(package private) Name
STYLESHEET_PREFIX
(package private) Name
TERMINATE
(package private) Name
TEST
(package private) Name
USE
(package private) Name
USE_ATTRIBUTE_SETS
(package private) Name
VALUE
(package private) Name
VERSION
(package private) Name
XSL_ATTRIBUTE
(package private) Name
XSL_FALLBACK
(package private) Name
XSL_FOR_EACH
(package private) Name
XSL_OTHERWISE
(package private) Name
XSL_SORT
(package private) Name
XSL_STYLESHEET
(package private) Name
XSL_TRANSFORM
(package private) Name
XSL_USE_ATTRIBUTE_SETS
(package private) Name
XSL_VENDOR
(package private) Name
XSL_VENDOR_URL
(package private) Name
XSL_VERSION
(package private) Name
XSL_WHEN
(package private) Name
XSL_WITH_PARAM
(package private) XMLProcessor
_omBuilder
(package private) com.jclark.xsl.tr.SheetImpl.OutputMethodImpl
_outputMethod
(package private) com.jclark.xsl.tr.SheetImpl.OutputMethodImpl
_runtimeOutputMethod
(package private) static NodeSetExpr
childrenExpr
(package private) Importance
currentImportance
(package private) VariableSet
currentLocalVariables
(package private) static StringVariant
emptyStringVariant
(package private) Vector
excludedNamespaces
(package private) ExtensionHandler
extensionHandler
(package private) int
importCount
(package private) int
nCurrentLocalVariables
(package private) NameTable
nameTable
(package private) LoadContext
sheetLoadContext

Fields inherited from interface com.jclark.xsl.om.NamespaceConstants

EXSL_COMMON_NAMESPACE, EXSL_DATE_NAMESPACE, EXSL_DYNAMIC_NAMESPACE, EXSL_FUNCTIONS_NAMESPACE, EXSL_MATH_NAMESPACE, EXSL_REGEXP_NAMESPACE, EXSL_SETS_NAMESPACE, EXSL_STRINGS_NAMESPACE, XFYXT_NAMESPACE, XSL_NAMESPACE, XT_NAMESPACE

Constructor Summary

SheetImpl(Node node, XMLProcessor omBuilder, ExtensionHandler extensionHandler, LoadContext sheetLoadContext, NameTable nameTable)
The constructor builds (compiles) a stylesheet

Method Summary

(package private) Action
addParams(ParamAction action, Node node)
void
clearOutputMethodProperties()
resets the output method to just those properties which were set in the stylesheet and/or defaults
ExtensionContext
createExtensionContext(String namespace)
(package private) static Name
expandSourceElementTypeName(String nameString, Node node)
Action
getAttributeSet(Name name)
(package private) String
getData(Node node)
ActionDebugTarget
getDebugger()
gets the xrap processor for use during processing
VariableInfo
getGlobalVariableInfo(Name name)
boolean
getIncludeComments()
boolean
getIncludeProcessingInstructions()
KeyDefinition
getKeyDefinition(Name keyName)
obtain the definition of the named key
TemplateRuleSet
getModeTemplateRuleSet(Name modeName)
obtain the collection of templates which may be applied in a named Mode
String
getNamespaceAlias(String ns)
(package private) NumberListFormatTemplate
getNumberListFormatTemplate(Node node)
(package private) String
getOptionalAttribute(Node node, Name name, String dflt)
OutputMethod
getOutputMethod()
returns the current values set either by client code, the stylesheet, or defaulted for the output method properties
Properties
getOutputMethodProperties()
returns the current values set either by client code, the stylesheet, or defaulted for the output method properties see java.xml.transform.Transform.getOutputMethodProperties()
String
getOutputMethodProperty(String encodedPropertyNamespace, String encodedPropertyName)
returns the current value of the named property
(package private) String
getPrefixNamespace(Node node, String prefix)
(package private) String
getRequiredAttribute(Node node, Name name)
SaxFilterMaker
getSaxExtensionFilter()
gets the xrap processor for use during processing
(package private) NodeSetExpr
getSortNodeSetExpr(Node node, NodeSetExpr expr)
LoadContext
getSourceLoadContext()
boolean
getStripSource(Name elementTypeName)
Variant
getSystemProperty(Name name)
(package private) VariantExpr
getVariantExpr(Node defNode)
gets the value for a variable or parameter
boolean
haveNamespaceAliases()
(package private) Action
parseActions(Node node, Action ifEmpty)
(package private) Action
parseActions(Node node, Action ifEmpty, AppendAction sequence)
(package private) Action
parseAttributesAndActions(Node node)
Parse the attributes on node as literal attributes and then parse the actions.
(package private) void
parseTopLevel(Node sheetNode)
come here if we have a "xsl:stylesheet" root element expect XSLT elements permitted at the top level ...
(package private) AppendAction
parseUseAttributeSets(Node node, boolean literal, AppendAction sequence)
(package private) Action
parseUseAttributeSetsAndActions(Node node)
Result
process(Node node, XMLProcessor omBuilder, ParameterSet params, Result root)
process an XML input document against this stylesheet
void
setDebugger(ActionDebugTarget debugger)
sets the xrap processor for use during processing
void
setOutputMethodProperty(String encodedPropertyNamespace, String encodedPropertyName, String value)
override the stylesheet's or default value for an output method property
void
setSaxExtensionFilter(SaxFilterMaker xrap)
sets the xrap processor for use during processing

Field Details

ATTRIBUTE

(package private)  Name ATTRIBUTE

CASE_ORDER

(package private)  Name CASE_ORDER

CDATA_SECTION_ELEMENTS

(package private)  Name CDATA_SECTION_ELEMENTS

COUNT

(package private)  Name COUNT

DATA_TYPE

(package private)  Name DATA_TYPE

DEFAULT

(package private)  Name DEFAULT

DISABLE_OUTPUT_ESCAPING

(package private)  Name DISABLE_OUTPUT_ESCAPING

DOCTYPE_PUBLIC

(package private)  Name DOCTYPE_PUBLIC

DOCTYPE_SYSTEM

(package private)  Name DOCTYPE_SYSTEM

ELEMENTS

(package private)  Name ELEMENTS

ENCODING

(package private)  Name ENCODING

EXCLUDE_RESULT_PREFIXES

(package private)  Name EXCLUDE_RESULT_PREFIXES

FORMAT

(package private)  Name FORMAT

FROM

(package private)  Name FROM

GROUPING_SEPARATOR

(package private)  Name GROUPING_SEPARATOR

GROUPING_SIZE

(package private)  Name GROUPING_SIZE

HREF

(package private)  Name HREF

INDENT

(package private)  Name INDENT

LANG

(package private)  Name LANG

LETTER_VALUE

(package private)  Name LETTER_VALUE

LEVEL

(package private)  Name LEVEL

MATCH

(package private)  Name MATCH

MEDIA_TYPE

(package private)  Name MEDIA_TYPE

METHOD

(package private)  Name METHOD

MODE

(package private)  Name MODE

NAME

(package private)  Name NAME

NAMESPACE

(package private)  Name NAMESPACE

OMIT_XML_DECLARATION

(package private)  Name OMIT_XML_DECLARATION

ORDER

(package private)  Name ORDER

PRIORITY

(package private)  Name PRIORITY

RESULT_PREFIX

(package private)  Name RESULT_PREFIX

SELECT

(package private)  Name SELECT

STANDALONE

(package private)  Name STANDALONE

STYLESHEET_PREFIX

(package private)  Name STYLESHEET_PREFIX

TERMINATE

(package private)  Name TERMINATE

TEST

(package private)  Name TEST

USE

(package private)  Name USE

USE_ATTRIBUTE_SETS

(package private)  Name USE_ATTRIBUTE_SETS

VALUE

(package private)  Name VALUE

VERSION

(package private)  Name VERSION

XSL_ATTRIBUTE

(package private)  Name XSL_ATTRIBUTE

XSL_FALLBACK

(package private)  Name XSL_FALLBACK

XSL_FOR_EACH

(package private)  Name XSL_FOR_EACH

XSL_OTHERWISE

(package private)  Name XSL_OTHERWISE

XSL_SORT

(package private)  Name XSL_SORT

XSL_STYLESHEET

(package private)  Name XSL_STYLESHEET

XSL_TRANSFORM

(package private)  Name XSL_TRANSFORM

XSL_USE_ATTRIBUTE_SETS

(package private)  Name XSL_USE_ATTRIBUTE_SETS

XSL_VENDOR

(package private)  Name XSL_VENDOR

XSL_VENDOR_URL

(package private)  Name XSL_VENDOR_URL

XSL_VERSION

(package private)  Name XSL_VERSION

XSL_WHEN

(package private)  Name XSL_WHEN

XSL_WITH_PARAM

(package private)  Name XSL_WITH_PARAM

_omBuilder

(package private)  XMLProcessor _omBuilder

_outputMethod

(package private)  com.jclark.xsl.tr.SheetImpl.OutputMethodImpl _outputMethod

_runtimeOutputMethod

(package private)  com.jclark.xsl.tr.SheetImpl.OutputMethodImpl _runtimeOutputMethod

childrenExpr

(package private) static NodeSetExpr childrenExpr

currentImportance

(package private)  Importance currentImportance

currentLocalVariables

(package private)  VariableSet currentLocalVariables

emptyStringVariant

(package private) static StringVariant emptyStringVariant

excludedNamespaces

(package private)  Vector excludedNamespaces

extensionHandler

(package private)  ExtensionHandler extensionHandler

importCount

(package private)  int importCount

nCurrentLocalVariables

(package private)  int nCurrentLocalVariables

nameTable

(package private)  NameTable nameTable

sheetLoadContext

(package private)  LoadContext sheetLoadContext

Constructor Details

SheetImpl

(package private)  SheetImpl(Node node,
                             XMLProcessor omBuilder,
                             ExtensionHandler extensionHandler,
                             LoadContext sheetLoadContext,
                             NameTable nameTable)
            throws IOException,
                   XSLException
The constructor builds (compiles) a stylesheet
Parameters:
node - the (xslt D) OM root Node of the loaded stylesheet
omBuilder - a (xslt D) OM builder we can use for included/imported sheets
extensionHandler - for extensions?
sheetLoadContext - ??
nameTable - ??

Method Details

addParams

(package private)  Action addParams(ParamAction action,
                                    Node node)
            throws XSLException

clearOutputMethodProperties

public void clearOutputMethodProperties()
resets the output method to just those properties which were set in the stylesheet and/or defaults
Specified by:
clearOutputMethodProperties in interface Sheet

createExtensionContext

public ExtensionContext createExtensionContext(String namespace)
            throws XSLException
Specified by:
createExtensionContext in interface SheetDetails

expandSourceElementTypeName

(package private) static Name expandSourceElementTypeName(String nameString,
                                                          Node node)
            throws XSLException

getAttributeSet

public Action getAttributeSet(Name name)
Specified by:
getAttributeSet in interface SheetDetails

getData

(package private)  String getData(Node node)
            throws XSLException

getDebugger

public ActionDebugTarget getDebugger()
gets the xrap processor for use during processing
Specified by:
getDebugger in interface Sheet
getDebugger in interface LoadContext

getGlobalVariableInfo

public VariableInfo getGlobalVariableInfo(Name name)
Specified by:
getGlobalVariableInfo in interface SheetDetails

getIncludeComments

public boolean getIncludeComments()
Specified by:
getIncludeComments in interface LoadContext
Returns:
true

getIncludeProcessingInstructions

public boolean getIncludeProcessingInstructions()
Specified by:
getIncludeProcessingInstructions in interface LoadContext
Returns:
true

getKeyDefinition

public KeyDefinition getKeyDefinition(Name keyName)
obtain the definition of the named key
Specified by:
getKeyDefinition in interface SheetDetails

getModeTemplateRuleSet

public TemplateRuleSet getModeTemplateRuleSet(Name modeName)
obtain the collection of templates which may be applied in a named Mode
Specified by:
getModeTemplateRuleSet in interface SheetDetails

getNamespaceAlias

public String getNamespaceAlias(String ns)
Specified by:
getNamespaceAlias in interface SheetDetails

getNumberListFormatTemplate

(package private)  NumberListFormatTemplate getNumberListFormatTemplate(Node node)
            throws XSLException

getOptionalAttribute

(package private)  String getOptionalAttribute(Node node,
                                               Name name,
                                               String dflt)

getOutputMethod

public OutputMethod getOutputMethod()
returns the current values set either by client code, the stylesheet, or defaulted for the output method properties
Specified by:
getOutputMethod in interface Sheet

getOutputMethodProperties

public Properties getOutputMethodProperties()
returns the current values set either by client code, the stylesheet, or defaulted for the output method properties see java.xml.transform.Transform.getOutputMethodProperties()
Specified by:
getOutputMethodProperties in interface Sheet

getOutputMethodProperty

public String getOutputMethodProperty(String encodedPropertyNamespace,
                                      String encodedPropertyName)
returns the current value of the named property
Specified by:
getOutputMethodProperty in interface Sheet

getPrefixNamespace

(package private)  String getPrefixNamespace(Node node,
                                             String prefix)
            throws XSLException
Returns:
the namespace URI reference for the given prefix in scope at the given Node

getRequiredAttribute

(package private)  String getRequiredAttribute(Node node,
                                               Name name)
            throws XSLException

getSaxExtensionFilter

public SaxFilterMaker getSaxExtensionFilter()
gets the xrap processor for use during processing
Specified by:
getSaxExtensionFilter in interface Sheet

getSortNodeSetExpr

(package private)  NodeSetExpr getSortNodeSetExpr(Node node,
                                                  NodeSetExpr expr)
            throws XSLException

getSourceLoadContext

public LoadContext getSourceLoadContext()
Specified by:
getSourceLoadContext in interface Sheet

getStripSource

public boolean getStripSource(Name elementTypeName)
Specified by:
getStripSource in interface LoadContext

getSystemProperty

public Variant getSystemProperty(Name name)
Specified by:
getSystemProperty in interface SheetDetails

getVariantExpr

(package private)  VariantExpr getVariantExpr(Node defNode)
            throws XSLException
gets the value for a variable or parameter

haveNamespaceAliases

public boolean haveNamespaceAliases()
Specified by:
haveNamespaceAliases in interface SheetDetails

parseActions

(package private)  Action parseActions(Node node,
                                       Action ifEmpty)
            throws XSLException

parseActions

(package private)  Action parseActions(Node node,
                                       Action ifEmpty,
                                       AppendAction sequence)
            throws XSLException

parseAttributesAndActions

(package private)  Action parseAttributesAndActions(Node node)
            throws XSLException
Parse the attributes on node as literal attributes and then parse the actions.

parseTopLevel

(package private)  void parseTopLevel(Node sheetNode)
            throws XSLException,
                   IOException
come here if we have a "xsl:stylesheet" root element expect XSLT elements permitted at the top level ... params, templates, keys, etc.

parseUseAttributeSets

(package private)  AppendAction parseUseAttributeSets(Node node,
                                                      boolean literal,
                                                      AppendAction sequence)
            throws XSLException

parseUseAttributeSetsAndActions

(package private)  Action parseUseAttributeSetsAndActions(Node node)
            throws XSLException

process

public Result process(Node node,
                      XMLProcessor omBuilder,
                      ParameterSet params,
                      Result root)
            throws XSLException
process an XML input document against this stylesheet
Specified by:
process in interface Sheet
Parameters:
node - the source document
omBuilder - an object model builder we can (re-)use for e.g. "document()"
params - the XSLT run-time parameters
root - the destination for thetransformation results

setDebugger

public void setDebugger(ActionDebugTarget debugger)
sets the xrap processor for use during processing
Specified by:
setDebugger in interface Sheet

setOutputMethodProperty

public void setOutputMethodProperty(String encodedPropertyNamespace,
                                    String encodedPropertyName,
                                    String value)
            throws XSLException
override the stylesheet's or default value for an output method property
Specified by:
setOutputMethodProperty in interface Sheet

setSaxExtensionFilter

public void setSaxExtensionFilter(SaxFilterMaker xrap)
sets the xrap processor for use during processing
Specified by:
setSaxExtensionFilter in interface Sheet