com.jclark.xsl.tr
Class SheetImpl

java.lang.Object
  extended by com.jclark.xsl.tr.SheetImpl
All Implemented Interfaces:
NamespaceConstants, LoadContext, Sheet, SheetDetails

 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)  XMLProcessor _omBuilder
           
(package private)  com.jclark.xsl.tr.SheetImpl.OutputMethodImpl _outputMethod
           
(package private)  com.jclark.xsl.tr.SheetImpl.OutputMethodImpl _runtimeOutputMethod
           
(package private)  Name ATTRIBUTE
           
(package private)  Name CASE_ORDER
           
(package private)  Name CDATA_SECTION_ELEMENTS
           
(package private) static NodeSetExpr childrenExpr
           
(package private)  Name COUNT
           
(package private)  Importance currentImportance
           
(package private)  VariableSet currentLocalVariables
           
(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) static StringVariant emptyStringVariant
           
(package private)  Name ENCODING
           
(package private)  Name EXCLUDE_RESULT_PREFIXES
           
(package private)  java.util.Vector excludedNamespaces
           
(package private)  ExtensionHandler extensionHandler
           
(package private)  Name FORMAT
           
(package private)  Name FROM
           
(package private)  Name GROUPING_SEPARATOR
           
(package private)  Name GROUPING_SIZE
           
(package private)  Name HREF
           
(package private)  int importCount
           
(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)  NameTable nameTable
           
(package private)  int nCurrentLocalVariables
           
(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)  LoadContext sheetLoadContext
           
(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
           
 
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(java.lang.String namespace)
           
(package private) static Name expandSourceElementTypeName(java.lang.String nameString, Node node)
           
 Action getAttributeSet(Name name)
          top level attribute set definition
(package private)  java.lang.String getData(Node node)
           
 ActionDebugTarget getDebugger()
          gets the xrap processor for use during processing
 VariableInfo getGlobalVariableInfo(Name name)
           
 boolean getIncludeComments()
          include comment nodes?
 boolean getIncludeProcessingInstructions()
          include processing instructions?
 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
 java.lang.String getNamespaceAlias(java.lang.String ns)
           
(package private)  NumberListFormatTemplate getNumberListFormatTemplate(Node node)
           
(package private)  java.lang.String getOptionalAttribute(Node node, Name name, java.lang.String dflt)
           
 OutputMethod getOutputMethod()
          returns the current values set either by client code, the stylesheet, or defaulted for the output method properties
 java.util.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()
 java.lang.String getOutputMethodProperty(java.lang.String encodedPropertyNamespace, java.lang.String encodedPropertyName)
          returns the current value of the named property
(package private)  java.lang.String getPrefixNamespace(Node node, java.lang.String prefix)
           
(package private)  java.lang.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()
          get the parameters controlling how a source tree object model is build
 boolean getStripSource(Name elementTypeName)
          white space handling
 Variant getSystemProperty(Name name)
          return the value of the named system property
(package private)  VariantExpr getVariantExpr(Node defNode)
          gets the value (an expression to be evaluated later) to be bound 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(java.lang.String encodedPropertyNamespace, java.lang.String encodedPropertyName, java.lang.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentImportance

Importance currentImportance

importCount

int importCount

childrenExpr

static NodeSetExpr childrenExpr

currentLocalVariables

VariableSet currentLocalVariables

nCurrentLocalVariables

int nCurrentLocalVariables

excludedNamespaces

java.util.Vector excludedNamespaces

_omBuilder

XMLProcessor _omBuilder

emptyStringVariant

static StringVariant emptyStringVariant

XSL_WHEN

Name XSL_WHEN

XSL_OTHERWISE

Name XSL_OTHERWISE

XSL_STYLESHEET

Name XSL_STYLESHEET

XSL_TRANSFORM

Name XSL_TRANSFORM

XSL_WITH_PARAM

Name XSL_WITH_PARAM

XSL_SORT

Name XSL_SORT

XSL_FOR_EACH

Name XSL_FOR_EACH

XSL_FALLBACK

Name XSL_FALLBACK

XSL_VERSION

Name XSL_VERSION

XSL_VENDOR

Name XSL_VENDOR

XSL_VENDOR_URL

Name XSL_VENDOR_URL

XSL_USE_ATTRIBUTE_SETS

Name XSL_USE_ATTRIBUTE_SETS

XSL_ATTRIBUTE

Name XSL_ATTRIBUTE

ATTRIBUTE

Name ATTRIBUTE

CASE_ORDER

Name CASE_ORDER

CDATA_SECTION_ELEMENTS

Name CDATA_SECTION_ELEMENTS

COUNT

Name COUNT

DATA_TYPE

Name DATA_TYPE

DEFAULT

Name DEFAULT

DISABLE_OUTPUT_ESCAPING

Name DISABLE_OUTPUT_ESCAPING

DOCTYPE_PUBLIC

Name DOCTYPE_PUBLIC

DOCTYPE_SYSTEM

Name DOCTYPE_SYSTEM

ELEMENTS

Name ELEMENTS

ENCODING

Name ENCODING

EXCLUDE_RESULT_PREFIXES

Name EXCLUDE_RESULT_PREFIXES

FORMAT

Name FORMAT

FROM

Name FROM

GROUPING_SEPARATOR

Name GROUPING_SEPARATOR

GROUPING_SIZE

Name GROUPING_SIZE

HREF

Name HREF

INDENT

Name INDENT

LANG

Name LANG

LETTER_VALUE

Name LETTER_VALUE

LEVEL

Name LEVEL

MATCH

Name MATCH

MEDIA_TYPE

Name MEDIA_TYPE

METHOD

Name METHOD

MODE

Name MODE

NAME

Name NAME

NAMESPACE

Name NAMESPACE

OMIT_XML_DECLARATION

Name OMIT_XML_DECLARATION

ORDER

Name ORDER

PRIORITY

Name PRIORITY

RESULT_PREFIX

Name RESULT_PREFIX

SELECT

Name SELECT

STANDALONE

Name STANDALONE

STYLESHEET_PREFIX

Name STYLESHEET_PREFIX

TERMINATE

Name TERMINATE

TEST

Name TEST

USE

Name USE

USE_ATTRIBUTE_SETS

Name USE_ATTRIBUTE_SETS

VALUE

Name VALUE

VERSION

Name VERSION

_outputMethod

com.jclark.xsl.tr.SheetImpl.OutputMethodImpl _outputMethod

_runtimeOutputMethod

com.jclark.xsl.tr.SheetImpl.OutputMethodImpl _runtimeOutputMethod

sheetLoadContext

LoadContext sheetLoadContext

nameTable

NameTable nameTable

extensionHandler

ExtensionHandler extensionHandler
Constructor Detail

SheetImpl

SheetImpl(Node node,
          XMLProcessor omBuilder,
          ExtensionHandler extensionHandler,
          LoadContext sheetLoadContext,
          NameTable nameTable)
    throws java.io.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 - ??
Throws:
java.io.IOException
XSLException
Method Detail

setSaxExtensionFilter

public void setSaxExtensionFilter(SaxFilterMaker xrap)
sets the xrap processor for use during processing

Specified by:
setSaxExtensionFilter in interface Sheet

getSaxExtensionFilter

public SaxFilterMaker getSaxExtensionFilter()
gets the xrap processor for use during processing

Specified by:
getSaxExtensionFilter in interface Sheet

setDebugger

public void setDebugger(ActionDebugTarget debugger)
sets the xrap processor for use during processing

Specified by:
setDebugger in interface Sheet

getDebugger

public ActionDebugTarget getDebugger()
gets the xrap processor for use during processing

Specified by:
getDebugger in interface LoadContext
Specified by:
getDebugger in interface Sheet

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 java.util.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

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

setOutputMethodProperty

public void setOutputMethodProperty(java.lang.String encodedPropertyNamespace,
                                    java.lang.String encodedPropertyName,
                                    java.lang.String value)
                             throws XSLException
override the stylesheet's or default value for an output method property

Specified by:
setOutputMethodProperty in interface Sheet
Throws:
XSLException

getOutputMethodProperty

public java.lang.String getOutputMethodProperty(java.lang.String encodedPropertyNamespace,
                                                java.lang.String encodedPropertyName)
returns the current value of the named property

Specified by:
getOutputMethodProperty in interface Sheet

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
Throws:
XSLException

getPrefixNamespace

java.lang.String getPrefixNamespace(Node node,
                                    java.lang.String prefix)
                              throws XSLException
Returns:
the namespace URI reference for the given prefix in scope at the given Node
Throws:
XSLException

parseTopLevel

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

Throws:
XSLException
java.io.IOException

parseAttributesAndActions

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

Throws:
XSLException

parseUseAttributeSetsAndActions

Action parseUseAttributeSetsAndActions(Node node)
                                 throws XSLException
Throws:
XSLException

parseUseAttributeSets

AppendAction parseUseAttributeSets(Node node,
                                   boolean literal,
                                   AppendAction sequence)
                             throws XSLException
Throws:
XSLException

parseActions

Action parseActions(Node node,
                    Action ifEmpty)
              throws XSLException
Throws:
XSLException

parseActions

Action parseActions(Node node,
                    Action ifEmpty,
                    AppendAction sequence)
              throws XSLException
Throws:
XSLException

getRequiredAttribute

java.lang.String getRequiredAttribute(Node node,
                                      Name name)
                                throws XSLException
Throws:
XSLException

getOptionalAttribute

java.lang.String getOptionalAttribute(Node node,
                                      Name name,
                                      java.lang.String dflt)

getData

java.lang.String getData(Node node)
                   throws XSLException
Throws:
XSLException

getNumberListFormatTemplate

NumberListFormatTemplate getNumberListFormatTemplate(Node node)
                                               throws XSLException
Throws:
XSLException

addParams

Action addParams(ParamAction action,
                 Node node)
           throws XSLException
Throws:
XSLException

getSortNodeSetExpr

NodeSetExpr getSortNodeSetExpr(Node node,
                               NodeSetExpr expr)
                         throws XSLException
Throws:
XSLException

getVariantExpr

VariantExpr getVariantExpr(Node defNode)
                     throws XSLException
gets the value (an expression to be evaluated later) to be bound for a variable or parameter

Throws:
XSLException

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

getKeyDefinition

public KeyDefinition getKeyDefinition(Name keyName)
obtain the definition of the named key

Specified by:
getKeyDefinition in interface SheetDetails

expandSourceElementTypeName

static Name expandSourceElementTypeName(java.lang.String nameString,
                                        Node node)
                                 throws XSLException
Throws:
XSLException

getSourceLoadContext

public LoadContext getSourceLoadContext()
Description copied from interface: Sheet
get the parameters controlling how a source tree object model is build

Specified by:
getSourceLoadContext in interface Sheet

getStripSource

public boolean getStripSource(Name elementTypeName)
Description copied from interface: LoadContext
white space handling

Specified by:
getStripSource in interface LoadContext

getIncludeComments

public boolean getIncludeComments()
Description copied from interface: LoadContext
include comment nodes?

Specified by:
getIncludeComments in interface LoadContext
Returns:
true

getIncludeProcessingInstructions

public boolean getIncludeProcessingInstructions()
Description copied from interface: LoadContext
include processing instructions?

Specified by:
getIncludeProcessingInstructions in interface LoadContext
Returns:
true

getGlobalVariableInfo

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

getSystemProperty

public Variant getSystemProperty(Name name)
Description copied from interface: SheetDetails
return the value of the named system property

Specified by:
getSystemProperty in interface SheetDetails

createExtensionContext

public ExtensionContext createExtensionContext(java.lang.String namespace)
                                        throws XSLException
Specified by:
createExtensionContext in interface SheetDetails
Throws:
XSLException

getAttributeSet

public Action getAttributeSet(Name name)
Description copied from interface: SheetDetails
top level attribute set definition

Specified by:
getAttributeSet in interface SheetDetails

haveNamespaceAliases

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

getNamespaceAlias

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