Package com.icl.saxon.style
Class StyleElement
- All Implemented Interfaces:
NodeInfo
,DOMLocator
,Source
,SourceLocator
,Element
,NamedNodeMap
,Node
,Locator
- Direct Known Subclasses:
AbsentExtensionElement
,LiteralResultElement
,SAXONDoctype
,SAXONEntityRef
,SAXONFunction
,SAXONItem
,SAXONPreview
,SAXONWhile
,SQLClose
,SQLConnect
,SQLInsert
,XSLApplyImports
,XSLApplyTemplates
,XSLAttributeSet
,XSLCallTemplate
,XSLChoose
,XSLCopy
,XSLCopyOf
,XSLDecimalFormat
,XSLElement
,XSLFallback
,XSLForEach
,XSLGeneralIncorporate
,XSLGeneralOutput
,XSLGeneralVariable
,XSLIf
,XSLKey
,XSLMessage
,XSLNamespaceAlias
,XSLNumber
,XSLOtherwise
,XSLPreserveSpace
,XSLScript
,XSLSort
,XSLStringConstructor
,XSLStyleSheet
,XSLTemplate
,XSLText
,XSLValueOf
,XSLWhen
Abstract superclass for all element nodes in the stylesheet.
Note: this class implements Locator. The element retains information about its own location in the stylesheet, which is useful when an XSL error is found.
Note: this class implements Locator. The element retains information about its own location in the stylesheet, which is useful when an XSL error is found.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Vector
protected short[]
static final int
static final int
static final int
protected int
protected StaticContext
protected TransformerConfigurationException
protected String
Fields inherited from class com.icl.saxon.tree.ElementWithAttributes
attributeList, namespaceList
Fields inherited from class com.icl.saxon.tree.ElementImpl
nameCode, root
Fields inherited from class com.icl.saxon.tree.ParentNodeImpl
sequence
Fields inherited from class com.icl.saxon.tree.NodeImpl
emptyArray, index, parent
Fields inherited from class com.icl.saxon.om.AbstractNode
NODE_LETTER
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbindVariable
(int fingerprint) Bind a variable used in this element to the XSLVariable element in which it is declaredvoid
Convenience method to check that the stylesheet element is emptyvoid
Convenience method to check that the stylesheet element is not at the top levelvoid
Convenience method to check that the stylesheet element is at the top levelprotected void
checkUnknownAttribute
(int nc) Check whether an unknown attribute is permitted.void
Check that the stylesheet element is within a template bodyprotected void
compileError
(String message) protected void
compileError
(TransformerException error) Construct an exception with diagnostic informationprotected boolean
definesExcludedNamespace
(short uriCode) Check whether this node excludes a particular namespace from the result.protected boolean
definesExtensionElement
(short uriCode) Check whether a particular extension element namespace is defined on this node.boolean
Determine whether this element does any processing after instantiating any children.protected void
fallbackProcessing
(StyleElement instruction, Context context) Perform fallback processingprotected void
findAttributeSets
(String use) Determine the list of attribute-sets associated with this element.boolean
Determine whether forwards-compatible mode is enabled for this elementGet the containing XSLStyleSheet elementint
Get the import precedence of this stylesheet element.Get the PreparedStyleSheet object.protected XSLStyleSheet
Get the principal XSLStyleSheet node.final StandardNames
Get the StandardNames objectgetStyleSheetFunction
(int fingerprint) Get a Function declared using a saxon:function element in the stylesheetgetVariableBinding
(int fprint) Bind a variable used in this element to the XSLVariable element in which it is declaredList the variables that are in scope for this stylesheet element.Get the version number on this element, or inherited from its ancestorsprotected Expression
handleSortKeys
(Expression select) Modify the "select" expression to include any sort keys specified.boolean
isExcludedNamespace
(short uriCode) Check whether a namespace uri defines an namespace excluded from the result.boolean
isExtensionNamespace
(short uriCode) Check whether a namespace uri defines an extension element.boolean
Determine whether this node is an instruction.boolean
Test whether this is a top-level elementmakeAttributeValueTemplate
(String expression) Make an attribute value template in the context of this stylesheet elementmakeExpression
(String expression) Make an expression in the context of this stylesheet elementmakePattern
(String pattern) Make a pattern in the context of this stylesheet elementboolean
Determine whether this type of element is allowed to contain a template-bodyabstract void
Set the attribute list for the element.void
Default preprocessing method does nothing.abstract void
Process: called to do the real work of this stylesheet element.void
Process the attributes of this element and all its childrenfinal void
Process the attribute list for the element.protected void
processAttributeSets
(Context context) Expand the attribute sets referenced in this element's use-attribute-sets attributevoid
processChildren
(Context context) Process the children of this node in the stylesheetprotected void
processExcludedNamespaces
(int nc) Process the [xsl:]exclude-result-prefixes attribute if there is oneprotected void
processExtensionElementAttribute
(int nc) Process the [xsl:]extension-element-prefixes attribute if there is oneprotected void
processVersionAttribute
(int nc) Process the [xsl:]version attribute if there is onevoid
reportAbsence
(String attribute) Convenience method to report the absence of a mandatory attributeprotected void
setValidationError
(TransformerException reason, int circumstances) Set a validation errorprotected TransformerException
styleError
(String message) protected TransformerException
styleError
(TransformerException error) Construct an exception with diagnostic informationvoid
substituteFor
(StyleElement temp) Make this node a substitute for a temporary one previously added to the tree.void
validate()
Check that the element is valid.protected void
void
Recursive walk through the stylesheet to validate all nodesMethods inherited from class com.icl.saxon.tree.ElementWithAttributes
addNamespaceNodes, copy, getAttribute, getAttributeList, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getAttributeValue, getAttributeValue, getAttributeValue, getLength, getNamedItem, getNamedItemNS, getNamespaceCodes, getPrefixForURI, getURICodeForPrefix, hasAttribute, hasAttributeNS, hasAttributes, initialise, item, outputNamespaceNodes, removeAttribute, removeAttributeNode, removeAttributeNS, removeNamedItem, removeNamedItemNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setNamedItem, setNamedItemNS, setNamespaceDeclarations
Methods inherited from class com.icl.saxon.tree.ElementImpl
copy, generateId, getBaseURI, getDocumentRoot, getLineNumber, getNameCode, getNodeType, getSystemId, makeNameCode, setLineNumber, setNameCode, setSystemId
Methods inherited from class com.icl.saxon.tree.ParentNodeImpl
addChild, compact, copyStringValue, dropChildren, enumerateChildren, getChildNodes, getFirstChild, getLastChild, getNodeValue, getNthChild, getSequenceNumber, getStringValue, hasChildNodes, removeChild, renumberChildren, useChildrenArray
Methods inherited from class com.icl.saxon.tree.NodeImpl
compareOrder, getDisplayName, getDocumentElement, getEnumeration, getFingerprint, getLocalName, getNamePool, getNextInDocument, getNextSibling, getOriginatingNode, getParent, getPrefix, getPreviousInDocument, getPreviousSibling, getURI, isSameNodeInfo, removeNode
Methods inherited from class com.icl.saxon.om.AbstractNode
appendChild, appendData, cloneNode, compareDocumentPosition, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, deleteData, disallowUpdate, getColumnNumber, getData, getDoctype, getElementById, getElementsByTagName, getElementsByTagNameNS, getFeature, getImplementation, getName, getNamespaceURI, getNodeName, getOwnerDocument, getOwnerElement, getParentNode, getPublicId, getSchemaTypeInfo, getSpecified, getTagName, getTextContent, getUserData, getValue, getWholeText, importNode, insertBefore, insertData, isDefaultNamespace, isElementContentWhitespace, isEqualNode, isId, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, replaceData, replaceWholeText, setData, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setNodeValue, setPrefix, setTextContent, setUserData, setValue, splitText, substringData, supports
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.w3c.dom.Element
getElementsByTagName, getElementsByTagNameNS, getSchemaTypeInfo, getTagName, setIdAttribute, setIdAttributeNode, setIdAttributeNS
Methods inherited from interface org.xml.sax.Locator
getColumnNumber, getLineNumber, getPublicId, getSystemId
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
-
Field Details
-
attributeSets
-
extensionNamespaces
protected short[] extensionNamespaces -
version
-
staticContext
-
validationError
-
reportingCircumstances
protected int reportingCircumstances -
REPORT_ALWAYS
public static final int REPORT_ALWAYS- See Also:
-
REPORT_UNLESS_FORWARDS_COMPATIBLE
public static final int REPORT_UNLESS_FORWARDS_COMPATIBLE- See Also:
-
REPORT_IF_INSTANTIATED
public static final int REPORT_IF_INSTANTIATED- See Also:
-
-
Constructor Details
-
StyleElement
public StyleElement()Constructor
-
-
Method Details
-
substituteFor
Make this node a substitute for a temporary one previously added to the tree. See StyleNodeFactory for details. "A node like the other one in all things but its class". Note that at this stage, the node will not yet be known to its parent, though it will contain a reference to its parent; and it will have no children. -
setValidationError
Set a validation error -
isInstruction
public boolean isInstruction()Determine whether this node is an instruction. The default implementation says it isn't. -
doesPostProcessing
public boolean doesPostProcessing()Determine whether this element does any processing after instantiating any children. The default implementation says it does. Tail recursion only works if call-template is nested entirely in elements that do no such processing. (If the element is empty, this property is irrelevant, because the element cannot contain an xsl:call-template). -
mayContainTemplateBody
public boolean mayContainTemplateBody()Determine whether this type of element is allowed to contain a template-body -
getContainingStyleSheet
Get the containing XSLStyleSheet element -
getPrecedence
public int getPrecedence()Get the import precedence of this stylesheet element. -
getStandardNames
Get the StandardNames object -
processAllAttributes
Process the attributes of this element and all its children -
processAttributes
Process the attribute list for the element. This is a wrapper method that calls prepareAttributes (provided in the subclass) and traps any exceptions -
checkUnknownAttribute
Check whether an unknown attribute is permitted.- Parameters:
nc
- The name code of the attribute name- Throws:
TransformerConfigurationException
-
prepareAttributes
Set the attribute list for the element. This is called to process the attributes (note the distinction from processAttributes in the superclass). Must be supplied in a subclass -
makeExpression
Make an expression in the context of this stylesheet element -
makePattern
Make a pattern in the context of this stylesheet element -
makeAttributeValueTemplate
public Expression makeAttributeValueTemplate(String expression) throws TransformerConfigurationException Make an attribute value template in the context of this stylesheet element -
processExtensionElementAttribute
Process the [xsl:]extension-element-prefixes attribute if there is one- Parameters:
nc
- the name code of the attribute required- Throws:
TransformerConfigurationException
-
processExcludedNamespaces
Process the [xsl:]exclude-result-prefixes attribute if there is one- Parameters:
nc
- the name code of the attribute required- Throws:
TransformerConfigurationException
-
processVersionAttribute
protected void processVersionAttribute(int nc) Process the [xsl:]version attribute if there is one- Parameters:
nc
- the name code of the attribute required
-
getVersion
Get the version number on this element, or inherited from its ancestors -
forwardsCompatibleModeIsEnabled
public boolean forwardsCompatibleModeIsEnabled()Determine whether forwards-compatible mode is enabled for this element -
definesExtensionElement
protected boolean definesExtensionElement(short uriCode) Check whether a particular extension element namespace is defined on this node. This checks this node only, not the ancestor nodes. The implementation checks whether the prefix is included in the [xsl:]extension-element-prefixes attribute.- Parameters:
uriCode
- the namespace URI code being tested
-
isExtensionNamespace
public boolean isExtensionNamespace(short uriCode) Check whether a namespace uri defines an extension element. This checks whether the namespace is defined as an extension namespace on this or any ancestor node.- Parameters:
uriCode
- the namespace URI code being tested
-
definesExcludedNamespace
protected boolean definesExcludedNamespace(short uriCode) Check whether this node excludes a particular namespace from the result. This method checks this node only, not the ancestor nodes.- Parameters:
uriCode
- the code of the namespace URI being tested
-
isExcludedNamespace
public boolean isExcludedNamespace(short uriCode) Check whether a namespace uri defines an namespace excluded from the result. This checks whether the namespace is defined as an excluded namespace on this or any ancestor node.- Parameters:
uriCode
- the code of the namespace URI being tested
-
validate
Check that the element is valid. This is called once for each element, after the entire tree has been built. As well as validation, it can perform first-time initialisation. The default implementation does nothing; it is normally overriden in subclasses. -
preprocess
Default preprocessing method does nothing. It is implemented for those top-level elements that can be evaluated before the source document is available, for example xsl:key, xsl:attribute-set, xsl:template, xsl:locale -
validateSubtree
Recursive walk through the stylesheet to validate all nodes -
validateChildren
-
getPrincipalStyleSheet
Get the principal XSLStyleSheet node. This gets the principal style sheet, i.e. the one originally loaded, that forms the root of the import/include tree -
getPreparedStyleSheet
Get the PreparedStyleSheet object.- Returns:
- the PreparedStyleSheet to which this stylesheet element belongs
-
checkWithinTemplate
Check that the stylesheet element is within a template body- Throws:
TransformerConfigurationException
- if not within a template body
-
checkTopLevel
Convenience method to check that the stylesheet element is at the top level- Throws:
TransformerConfigurationException
- if not at top level
-
checkNotTopLevel
Convenience method to check that the stylesheet element is not at the top level- Throws:
TransformerConfigurationException
- if it is at the top level
-
checkEmpty
Convenience method to check that the stylesheet element is empty- Throws:
TransformerConfigurationException
- if it is not empty
-
reportAbsence
Convenience method to report the absence of a mandatory attribute- Throws:
TransformerConfigurationException
- if the attribute is missing
-
process
Process: called to do the real work of this stylesheet element. This method must be implemented in each subclass.- Parameters:
context
- The context in the source XML document, giving access to the current node, the current variables, etc.- Throws:
TransformerException
-
processChildren
Process the children of this node in the stylesheet- Parameters:
context
- The context in the source XML document, giving access to the current node, the current variables, etc.- Throws:
TransformerException
-
fallbackProcessing
protected void fallbackProcessing(StyleElement instruction, Context context) throws TransformerException Perform fallback processing- Throws:
TransformerException
-
handleSortKeys
Modify the "select" expression to include any sort keys specified. Used in XSLForEach and XSLApplyTemplates -
findAttributeSets
Determine the list of attribute-sets associated with this element. This is used for xsl:element, xsl:copy, xsl:attribute-set, and on literal result elements -
processAttributeSets
Expand the attribute sets referenced in this element's use-attribute-sets attribute- Throws:
TransformerException
-
styleError
Construct an exception with diagnostic information -
styleError
-
compileError
Construct an exception with diagnostic information -
compileError
-
isTopLevel
public boolean isTopLevel()Test whether this is a top-level element -
bindVariable
Bind a variable used in this element to the XSLVariable element in which it is declared- Parameters:
fingerprint
- The fingerprint of the name of the variable- Returns:
- a Binding for the variable
- Throws:
XPathException
- if the variable has not been declared
-
getVariableBinding
Bind a variable used in this element to the XSLVariable element in which it is declared- Parameters:
fprint
- The absolute name of the variable (as a namepool fingerprint)- Returns:
- a Binding for the variable, or null if it has not been declared
-
getVariableNames
List the variables that are in scope for this stylesheet element. Designed for a debugger, not used by the processor.- Returns:
- two Enumeration of Strings, the global ones [0] and the local ones [1]
-
getStyleSheetFunction
Get a Function declared using a saxon:function element in the stylesheet- Parameters:
fingerprint
- the fingerprint of the name of the function- Returns:
- the Function object represented by this saxon:function; or null if not found
-