Package net.sf.saxon.style
Class StyleElement
- java.lang.Object
-
- net.sf.saxon.tree.NodeImpl
-
- net.sf.saxon.tree.ParentNodeImpl
-
- net.sf.saxon.tree.ElementImpl
-
- net.sf.saxon.tree.ElementWithAttributes
-
- net.sf.saxon.style.StyleElement
-
- All Implemented Interfaces:
javax.xml.transform.Source,javax.xml.transform.SourceLocator,LocationProvider,SaxonLocator,Container,FingerprintedNode,Item,NodeInfo,ValueRepresentation,InstructionInfo,org.xml.sax.Locator
- Direct Known Subclasses:
AbsentExtensionElement,ExtensionInstruction,LiteralResultElement,SaxonCollation,SaxonDoctype,SaxonEntityRef,SaxonImportQuery,SaxonScript,SaxonWhile,XSLAnalyzeString,XSLApplyImports,XSLApplyTemplates,XSLAttributeSet,XSLCallTemplate,XSLCharacterMap,XSLChoose,XSLCopy,XSLCopyOf,XSLDecimalFormat,XSLDocument,XSLElement,XSLFallback,XSLForEach,XSLForEachGroup,XSLFunction,XSLGeneralIncorporate,XSLGeneralVariable,XSLIf,XSLImportSchema,XSLKey,XSLMatchingSubstring,XSLMessage,XSLNamespaceAlias,XSLNextMatch,XSLNumber,XSLOtherwise,XSLOutput,XSLOutputCharacter,XSLPerformSort,XSLPreserveSpace,XSLResultDocument,XSLSequence,XSLSort,XSLStringConstructor,XSLStylesheet,XSLTemplate,XSLWhen
public abstract class StyleElement extends ElementWithAttributes implements org.xml.sax.Locator, Container, InstructionInfo
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.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringdefaultCollationNameprotected java.lang.StringdefaultXPathNamespaceprotected short[]extensionNamespacesstatic intREPORT_ALWAYSstatic intREPORT_IF_INSTANTIATEDstatic intREPORT_UNLESS_FALLBACK_AVAILABLEstatic intREPORT_UNLESS_FORWARDS_COMPATIBLEprotected intreportingCircumstancesprotected StaticContextstaticContextprotected StaticErrorvalidationErrorprotected java.math.BigDecimalversion-
Fields inherited from class net.sf.saxon.tree.ElementWithAttributes
attributeList, namespaceList
-
Fields inherited from class net.sf.saxon.tree.ElementImpl
nameCode, root
-
Fields inherited from class net.sf.saxon.tree.ParentNodeImpl
sequence
-
Fields inherited from class net.sf.saxon.tree.NodeImpl
index, NODE_LETTER, parent
-
Fields inherited from interface net.sf.saxon.om.NodeInfo
ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES
-
Fields inherited from interface net.sf.saxon.om.ValueRepresentation
EMPTY_VALUE_ARRAY
-
-
Constructor Summary
Constructors Constructor Description StyleElement()Constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intallocateLocationId(java.lang.String systemId, int lineNumber)Allocate a location identifiervoidallocateSlots(Expression exp)Allocate slots in the local stack frame to range variables used in an XPath expressionbooleanbackwardsCompatibleModeIsEnabled()Determine whether backwards-compatible mode is enabled for this elementXSLVariableDeclarationbindVariable(int fingerprint)Bind a variable used in this element to the compiled form of the XSLVariable element in which it is declaredvoidcheckEmpty()Convenience method to check that the stylesheet element is emptyprotected voidcheckSortComesFirst(boolean sortRequired)Check that among the children of this element, any xsl:sort elements precede any other elementsvoidcheckTopLevel(java.lang.String errorCode)Convenience method to check that the stylesheet element is at the top levelprotected voidcheckUnknownAttribute(int nc)Check whether an unknown attribute is permitted.voidcheckWithinTemplate()Check that the stylesheet element is within a sequence constructorabstract Expressioncompile(Executable exec)Compile the instruction on the stylesheet tree into an executable instruction for use at run-time.protected voidcompileError(java.lang.String message)protected voidcompileError(java.lang.String message, java.lang.String errorCode)Compile time error, specifying an error codeprotected voidcompileError(javax.xml.transform.TransformerException error)Construct an exception with diagnostic informationExpressioncompileSequenceConstructor(Executable exec, AxisIterator iter, boolean includeParams)Compile the children of this instruction on the stylesheet tree, adding the subordinate instructions to the parent instruction on the execution tree.protected voidcompileWarning(java.lang.String message, java.lang.String errorCode)protected booleandefinesExcludedNamespace(short uriCode)Check whether this node excludes a particular namespace from the result.protected booleandefinesExtensionElement(short uriCode)Check whether a particular extension element namespace is defined on this node.protected ExpressionfallbackProcessing(Executable exec, StyleElement instruction)Perform fallback processing.voidfixupReferences()Fix up references from XPath expressions.booleanforwardsCompatibleModeIsEnabled()Determine whether forwards-compatible mode is enabled for this elementprotected AttributeSet[]getAttributeSets(java.lang.String use, java.util.List list)Get the list of attribute-sets associated with this element.java.lang.StringgetAttributeValue(java.lang.String clarkName)Get an attribute value given the Clark name of the attribute (that is, the name in {uri}local format).protected ItemTypegetCommonChildItemType()Get the most general type of item returned by the children of this instructionintgetConstructType()Get the type of construct.SlotManagergetContainingSlotManager()Get the SlotManager for the containing Procedure definitionXSLStylesheetgetContainingStylesheet()Get the containing XSLStylesheet elementprotected java.lang.StringgetDefaultCollationName()Get the default collation for this stylesheet element.protected shortgetDefaultXPathNamespace()Get the default XPath namespace code applicable to this elementExecutablegetExecutable()Get the Executable (representing a complete stylesheet or query) of which this Container forms partintgetHostLanguage()Get the host language (XSLT, XQuery, XPath) used to implement the code in this containerprotected StyleElementgetLastChildInstruction()Find the last child instruction of this instruction.intgetLineNumber()Get the line number of the node within its source document entityintgetLineNumber(int locationId)Get the line number within the document or module containing a particular locationLocationProvidergetLocationProvider()Get the LocationProvider allowing location identifiers to be resolved.NamespaceResolvergetNamespaceResolver()Get the namespace context of the instruction.intgetObjectFingerprint()Get a fingerprint identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc.intgetObjectNameCode()Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc.intgetPrecedence()Get the import precedence of this stylesheet element.PreparedStylesheetgetPreparedStylesheet()Get the PreparedStylesheet object.protected XSLStylesheetgetPrincipalStylesheet()Get the principal XSLStylesheet node.java.util.IteratorgetProperties()Get an iterator over all the properties available.java.lang.ObjectgetProperty(java.lang.String name)Get the value of a particular property of the instruction.protected ItemTypegetReturnedItemType()Determine the type of item returned by this instruction (only relevant if it is an instruction).SchemaTypegetSchemaType(java.lang.String typeAtt)Get the Schema type definition for a type named in the stylesheet (in a "type" attribute).StaticContextgetStaticContext()Get the static context for expressions on this elementXSLFunctiongetStylesheetFunction(int fingerprint, int arity)Get a FunctionCall declared using an xsl:function element in the stylesheetjava.lang.StringgetSystemId(int locationId)Get the URI of the document or module containing a particular locationNamePoolgetTargetNamePool()Get the namepool to be used at run-time, this namepool holds the names used in all XPath expressions and patternsintgetTypeAnnotation(SchemaType schemaType)Get the type annotation to use for a given schema typejava.math.BigDecimalgetVersion()Get the numeric value of the version number on this element, or inherited from its ancestorsprotected WithParam[]getWithParamInstructions(Executable exec, boolean tunnel, Instruction caller)Get the list of xsl:with-param elements for a calling element (apply-templates, call-template, apply-imports, next-match).booleanisExcludedNamespace(short uriCode)Check whether a namespace uri defines an namespace excluded from the result.protected booleanisExplaining()Determine whether saxon:explain has been set to "yes"booleanisExtensionNamespace(short uriCode)Check whether a namespace uri defines an extension element.booleanisInstruction()Determine whether this node is an instruction.protected booleanisPermittedChild(StyleElement child)Specify that certain children are permitted for this elementprotected voidissueWarning(java.lang.String message, javax.xml.transform.SourceLocator locator)protected voidissueWarning(javax.xml.transform.TransformerException error)Construct an exception with diagnostic informationbooleanisTopLevel()Test whether this is a top-level elementExpressionmakeAttributeValueTemplate(java.lang.String expression)Make an attribute value template in the context of this stylesheet elementExpressionmakeExpression(java.lang.String expression)Make an expression in the context of this stylesheet elementintmakeNameCode(java.lang.String qname)Make a NameCode, using this Element as the context for namespace resolution, and registering the code in the namepool.SavedNamespaceContextmakeNamespaceContext()Make a NamespaceContext object representing the list of in-scope namespaces.PatternmakePattern(java.lang.String pattern)Make a pattern in the context of this stylesheet elementSequenceTypemakeSequenceType(java.lang.String sequenceType)Process an attribute whose value is a SequenceTypeprotected SortKeyDefinition[]makeSortKeys()Construct sort keys for a SortedIteratorprotected static TraceWrappermakeTraceInstruction(StyleElement source, Expression child)Create a trace instruction to wrap a real instructionvoidmarkTailCalls()Mark tail-recursive calls on templates and functions.booleanmayContainFallback()Determine whether this type of element is allowed to contain an xsl:fallback instructionbooleanmayContainSequenceConstructor()Determine whether this type of element is allowed to contain a sequence constructorvoidpostValidate()Hook to allow additional validation of a parent element immediately after its children have been validated.abstract voidprepareAttributes()Set the attribute list for the element.voidprocessAllAttributes()Process the attributes of this element and all its childrenvoidprocessAttributes()Process the attribute list for the element.protected voidprocessDefaultCollationAttribute(java.lang.String nc)Process the [xsl:]default-xpath-namespace attribute if there is oneprotected voidprocessDefaultXPathNamespaceAttribute(java.lang.String nc)Process the [xsl:]default-xpath-namespace attribute if there is oneprotected voidprocessExcludedNamespaces(java.lang.String nc)Process the [xsl:]exclude-result-prefixes attribute if there is oneprotected voidprocessExtensionElementAttribute(java.lang.String nc)Process the [xsl:]extension-element-prefixes attribute if there is oneprotected voidprocessVersionAttribute(java.lang.String nc)Process the [xsl:]version attribute if there is onebooleanreplaceSubExpression(Expression original, Expression replacement)Replace one subexpression by a replacement subexpressionvoidreportAbsence(java.lang.String attribute)Convenience method to report the absence of a mandatory attributevoidsetLineNumber(int lineNumber)Set the line number of the element within its source document entityvoidsetObjectNameCode(int nameCode)Set the object name codeprotected voidsetValidationError(javax.xml.transform.TransformerException reason, int circumstances)Set a validation errorvoidsubstituteFor(StyleElement temp)Make this node a substitute for a temporary one previously added to the tree.ExpressiontypeCheck(java.lang.String name, Expression exp)Type-check an expression.PatterntypeCheck(java.lang.String name, Pattern pattern)Type-check a pattern.protected voidundeclaredNamespaceError(java.lang.String prefix, java.lang.String errorCode)voidvalidate()Check that the stylesheet element is valid.protected voidvalidateChildren()Validate the children of this node, recursively.voidvalidateSubtree()Recursive walk through the stylesheet to validate all nodes-
Methods inherited from class net.sf.saxon.tree.ElementWithAttributes
copy, getAttributeList, getAttributeValue, getDeclaredNamespaces, getInScopeNamespaceCodes, getPrefixForURI, getURICodeForPrefix, getURIForPrefix, initialise, iteratePrefixes, sendNamespaceDeclarations, setNamespaceDeclarations
-
Methods inherited from class net.sf.saxon.tree.ElementImpl
generateId, getBaseURI, getDocumentRoot, getNameCode, getNodeKind, getRoot, getSystemId, setNameCode, setSystemId
-
Methods inherited from class net.sf.saxon.tree.ParentNodeImpl
addChild, compact, enumerateChildren, getFirstChild, getLastChild, getNthChild, getSequenceNumber, getStringValue, getStringValueCS, hasChildNodes, useChildrenArray
-
Methods inherited from class net.sf.saxon.tree.NodeImpl
atomize, compareOrder, equals, getColumnNumber, getConfiguration, getDisplayName, getDocumentNumber, getFingerprint, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getTypeAnnotation, getTypedValue, getURI, hashCode, isSameNodeInfo, iterateAxis, iterateAxis
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.trace.InstructionInfo
getSystemId
-
-
-
-
Field Detail
-
extensionNamespaces
protected short[] extensionNamespaces
-
version
protected java.math.BigDecimal version
-
staticContext
protected StaticContext staticContext
-
validationError
protected StaticError validationError
-
reportingCircumstances
protected int reportingCircumstances
-
defaultXPathNamespace
protected java.lang.String defaultXPathNamespace
-
defaultCollationName
protected java.lang.String defaultCollationName
-
REPORT_ALWAYS
public static final int REPORT_ALWAYS
- See Also:
- Constant Field Values
-
REPORT_UNLESS_FORWARDS_COMPATIBLE
public static final int REPORT_UNLESS_FORWARDS_COMPATIBLE
- See Also:
- Constant Field Values
-
REPORT_IF_INSTANTIATED
public static final int REPORT_IF_INSTANTIATED
- See Also:
- Constant Field Values
-
REPORT_UNLESS_FALLBACK_AVAILABLE
public static final int REPORT_UNLESS_FALLBACK_AVAILABLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getExecutable
public Executable getExecutable()
Description copied from interface:ContainerGet the Executable (representing a complete stylesheet or query) of which this Container forms part- Specified by:
getExecutablein interfaceContainer
-
getLocationProvider
public LocationProvider getLocationProvider()
Get the LocationProvider allowing location identifiers to be resolved.- Specified by:
getLocationProviderin interfaceContainer
-
getTargetNamePool
public NamePool getTargetNamePool()
Get the namepool to be used at run-time, this namepool holds the names used in all XPath expressions and patterns
-
getStaticContext
public StaticContext getStaticContext()
Get the static context for expressions on this element- Returns:
- the static context
-
getLineNumber
public int getLineNumber()
Description copied from class:ElementImplGet the line number of the node within its source document entity- Specified by:
getLineNumberin interfaceInstructionInfo- Specified by:
getLineNumberin interfaceorg.xml.sax.Locator- Specified by:
getLineNumberin interfaceNodeInfo- Specified by:
getLineNumberin interfacejavax.xml.transform.SourceLocator- Overrides:
getLineNumberin classElementImpl- Returns:
- the line number of the node in its original source document; or -1 if not available
-
setLineNumber
public void setLineNumber(int lineNumber)
Description copied from class:ElementImplSet the line number of the element within its source document entity- Overrides:
setLineNumberin classElementImpl
-
isExplaining
protected boolean isExplaining()
Determine whether saxon:explain has been set to "yes"
-
substituteFor
public void substituteFor(StyleElement temp)
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
protected void setValidationError(javax.xml.transform.TransformerException reason, int circumstances)Set a validation error
-
isInstruction
public boolean isInstruction()
Determine whether this node is an instruction. The default implementation says it isn't.
-
getReturnedItemType
protected ItemType getReturnedItemType()
Determine the type of item returned by this instruction (only relevant if it is an instruction). Default implementation returns Type.ITEM, indicating that we don't know, it might be anything. Returns null in the case of an element such as xsl:sort or xsl:variable that can appear in a sequence constructor but contributes nothing to the result sequence.- Returns:
- the item type returned
-
getCommonChildItemType
protected ItemType getCommonChildItemType()
Get the most general type of item returned by the children of this instruction- Returns:
- the lowest common supertype of the item types returned by the children
-
markTailCalls
public void markTailCalls()
Mark tail-recursive calls on templates and functions. For most instructions, this does nothing.
-
mayContainSequenceConstructor
public boolean mayContainSequenceConstructor()
Determine whether this type of element is allowed to contain a sequence constructor
-
mayContainFallback
public boolean mayContainFallback()
Determine whether this type of element is allowed to contain an xsl:fallback instruction
-
getContainingStylesheet
public XSLStylesheet getContainingStylesheet()
Get the containing XSLStylesheet element
-
getPrecedence
public int getPrecedence()
Get the import precedence of this stylesheet element.
-
makeNameCode
public final int makeNameCode(java.lang.String qname) throws XPathException, NamespaceExceptionMake a NameCode, using this Element as the context for namespace resolution, and registering the code in the namepool. If the name is unprefixed, the default namespace is not used.- Parameters:
qname- The name as written, in the form "[prefix:]localname". The name must have already been validated as a syntactically-correct QName.- Throws:
XPathException- if the qname is not a lexically-valid QName, or if the name is in a reserved namespace.NamespaceException- if the prefix of the qname has not been declared
-
makeNamespaceContext
public SavedNamespaceContext makeNamespaceContext()
Make a NamespaceContext object representing the list of in-scope namespaces. The NamePool used for numeric codes in the NamespaceContext will be the target name pool.
-
processAllAttributes
public void processAllAttributes() throws XPathExceptionProcess the attributes of this element and all its children- Throws:
XPathException
-
getAttributeValue
public java.lang.String getAttributeValue(java.lang.String clarkName)
Get an attribute value given the Clark name of the attribute (that is, the name in {uri}local format).
-
processAttributes
public final void processAttributes() throws XPathExceptionProcess the attribute list for the element. This is a wrapper method that calls prepareAttributes (provided in the subclass) and traps any exceptions- Throws:
XPathException
-
checkUnknownAttribute
protected void checkUnknownAttribute(int nc) throws XPathExceptionCheck whether an unknown attribute is permitted.- Parameters:
nc- The name code of the attribute name- Throws:
XPathException
-
prepareAttributes
public abstract void prepareAttributes() throws XPathExceptionSet 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- Throws:
XPathException
-
getLastChildInstruction
protected StyleElement getLastChildInstruction()
Find the last child instruction of this instruction. Returns null if there are no child instructions, or if the last child is a text node.
-
makeExpression
public Expression makeExpression(java.lang.String expression) throws XPathException
Make an expression in the context of this stylesheet element- Throws:
XPathException
-
makePattern
public Pattern makePattern(java.lang.String pattern) throws XPathException
Make a pattern in the context of this stylesheet element- Throws:
XPathException
-
makeAttributeValueTemplate
public Expression makeAttributeValueTemplate(java.lang.String expression) throws XPathException
Make an attribute value template in the context of this stylesheet element- Throws:
XPathException
-
makeSequenceType
public SequenceType makeSequenceType(java.lang.String sequenceType) throws XPathException
Process an attribute whose value is a SequenceType- Throws:
XPathException
-
processExtensionElementAttribute
protected void processExtensionElementAttribute(java.lang.String nc) throws XPathExceptionProcess the [xsl:]extension-element-prefixes attribute if there is one- Parameters:
nc- the Clark name of the attribute required- Throws:
XPathException
-
processExcludedNamespaces
protected void processExcludedNamespaces(java.lang.String nc) throws XPathExceptionProcess the [xsl:]exclude-result-prefixes attribute if there is one- Parameters:
nc- the Clark name of the attribute required- Throws:
XPathException
-
processVersionAttribute
protected void processVersionAttribute(java.lang.String nc) throws XPathExceptionProcess the [xsl:]version attribute if there is one- Parameters:
nc- the Clark name of the attribute required- Throws:
XPathException
-
getVersion
public java.math.BigDecimal getVersion()
Get the numeric value of 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
-
backwardsCompatibleModeIsEnabled
public boolean backwardsCompatibleModeIsEnabled()
Determine whether backwards-compatible mode is enabled for this element
-
processDefaultCollationAttribute
protected void processDefaultCollationAttribute(java.lang.String nc) throws XPathExceptionProcess the [xsl:]default-xpath-namespace attribute if there is one- Parameters:
nc- the Clark name of the attribute required- Throws:
XPathException
-
getDefaultCollationName
protected java.lang.String getDefaultCollationName()
Get the default collation for this stylesheet element. If no default collation is specified in the stylesheet, return the Unicode codepoint collation name.
-
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
-
processDefaultXPathNamespaceAttribute
protected void processDefaultXPathNamespaceAttribute(java.lang.String nc)
Process the [xsl:]default-xpath-namespace attribute if there is one- Parameters:
nc- the Clark name of the attribute required
-
getDefaultXPathNamespace
protected short getDefaultXPathNamespace()
Get the default XPath namespace code applicable to this element
-
getSchemaType
public SchemaType getSchemaType(java.lang.String typeAtt) throws XPathException
Get the Schema type definition for a type named in the stylesheet (in a "type" attribute).- Throws:
XPathException- if the type is not declared in an imported schema, or is not a built-in type
-
getTypeAnnotation
public int getTypeAnnotation(SchemaType schemaType)
Get the type annotation to use for a given schema type
-
validate
public void validate() throws XPathExceptionCheck that the stylesheet 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.- Throws:
XPathException
-
postValidate
public void postValidate() throws XPathExceptionHook to allow additional validation of a parent element immediately after its children have been validated.- Throws:
XPathException
-
typeCheck
public Expression typeCheck(java.lang.String name, Expression exp) throws XPathException
Type-check an expression. This is called to check each expression while the containing instruction is being validated. It is not just a static type-check, it also adds code to perform any necessary run-time type checking and/or conversion.- Throws:
XPathException
-
allocateSlots
public void allocateSlots(Expression exp)
Allocate slots in the local stack frame to range variables used in an XPath expression- Parameters:
exp- the XPath expression for which slots are to be allocated
-
typeCheck
public Pattern typeCheck(java.lang.String name, Pattern pattern) throws XPathException
Type-check a pattern. This is called to check each pattern while the containing instruction is being validated. It is not just a static type-check, it also adds code to perform any necessary run-time type checking and/or conversion.- Throws:
XPathException
-
fixupReferences
public void fixupReferences() throws XPathExceptionFix up references from XPath expressions. Overridden for function declarations and variable declarations- Throws:
XPathException
-
getContainingSlotManager
public SlotManager getContainingSlotManager()
Get the SlotManager for the containing Procedure definition- Returns:
- the SlotManager associated with the containing Function, Template, etc, or null if there is no such containing Function, Template etc.
-
validateSubtree
public void validateSubtree() throws XPathExceptionRecursive walk through the stylesheet to validate all nodes- Throws:
XPathException
-
validateChildren
protected void validateChildren() throws XPathExceptionValidate the children of this node, recursively. Overridden for top-level data elements.- Throws:
XPathException
-
isPermittedChild
protected boolean isPermittedChild(StyleElement child)
Specify that certain children are permitted for this element
-
getPrincipalStylesheet
protected XSLStylesheet 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
public PreparedStylesheet getPreparedStylesheet()
Get the PreparedStylesheet object.- Returns:
- the PreparedStylesheet to which this stylesheet element belongs
-
checkWithinTemplate
public void checkWithinTemplate() throws XPathExceptionCheck that the stylesheet element is within a sequence constructor- Throws:
XPathException- if not within a sequence constructor
-
checkSortComesFirst
protected void checkSortComesFirst(boolean sortRequired) throws XPathExceptionCheck that among the children of this element, any xsl:sort elements precede any other elements- Parameters:
sortRequired- true if there must be at least one xsl:sort element- Throws:
XPathException- if invalid
-
checkTopLevel
public void checkTopLevel(java.lang.String errorCode) throws XPathExceptionConvenience method to check that the stylesheet element is at the top level- Throws:
XPathException- if not at top level
-
checkEmpty
public void checkEmpty() throws XPathExceptionConvenience method to check that the stylesheet element is empty- Throws:
XPathException- if it is not empty
-
reportAbsence
public void reportAbsence(java.lang.String attribute) throws XPathExceptionConvenience method to report the absence of a mandatory attribute- Throws:
XPathException- if the attribute is missing
-
compile
public abstract Expression compile(Executable exec) throws XPathException
Compile the instruction on the stylesheet tree into an executable instruction for use at run-time.- Returns:
- either a ComputedExpression, or null. The value null is returned when compiling an instruction that returns a no-op, or when compiling a top-level object such as an xsl:template that compiles into something other than an instruction.
- Throws:
XPathException
-
compileSequenceConstructor
public Expression compileSequenceConstructor(Executable exec, AxisIterator iter, boolean includeParams) throws XPathException
Compile the children of this instruction on the stylesheet tree, adding the subordinate instructions to the parent instruction on the execution tree.- Returns:
- the array of children
- Throws:
XPathException
-
makeTraceInstruction
protected static TraceWrapper makeTraceInstruction(StyleElement source, Expression child)
Create a trace instruction to wrap a real instruction
-
fallbackProcessing
protected Expression fallbackProcessing(Executable exec, StyleElement instruction) throws XPathException
Perform fallback processing. Generate fallback code for an extension instruction that is not recognized by the implementation.- Parameters:
instruction- The unknown extension instruction- Throws:
XPathException
-
allocateLocationId
public int allocateLocationId(java.lang.String systemId, int lineNumber)Allocate a location identifier
-
makeSortKeys
protected SortKeyDefinition[] makeSortKeys() throws XPathException
Construct sort keys for a SortedIterator- Returns:
- an array of SortKeyDefinition objects if there are any sort keys; or null if there are none.
- Throws:
XPathException
-
getAttributeSets
protected AttributeSet[] getAttributeSets(java.lang.String use, java.util.List list) throws XPathException
Get 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- Parameters:
use- the original value of the [xsl:]use-attribute-sets attributelist- an empty list to hold the list of XSLAttributeSet elements in the stylesheet tree. Or null, if these are not required.- Returns:
- an array of AttributeList instructions representing the compiled attribute sets
- Throws:
XPathException
-
getWithParamInstructions
protected WithParam[] getWithParamInstructions(Executable exec, boolean tunnel, Instruction caller) throws XPathException
Get the list of xsl:with-param elements for a calling element (apply-templates, call-template, apply-imports, next-match). This method can be used to get either the tunnel parameters, or the non-tunnel parameters.- Parameters:
tunnel- true if the tunnel="yes" parameters are wanted, false to getcaller-- Throws:
XPathException
-
compileError
protected void compileError(javax.xml.transform.TransformerException error) throws XPathExceptionConstruct an exception with diagnostic information- Throws:
XPathException
-
compileError
protected void compileError(java.lang.String message) throws XPathException- Throws:
XPathException
-
compileError
protected void compileError(java.lang.String message, java.lang.String errorCode) throws XPathExceptionCompile time error, specifying an error code- Parameters:
message- the error messageerrorCode- the error code. May be null if not known or not defined- Throws:
XPathException
-
undeclaredNamespaceError
protected void undeclaredNamespaceError(java.lang.String prefix, java.lang.String errorCode) throws XPathException- Throws:
XPathException
-
compileWarning
protected void compileWarning(java.lang.String message, java.lang.String errorCode) throws XPathException- Throws:
XPathException
-
issueWarning
protected void issueWarning(javax.xml.transform.TransformerException error)
Construct an exception with diagnostic information
-
issueWarning
protected void issueWarning(java.lang.String message, javax.xml.transform.SourceLocator locator)
-
isTopLevel
public boolean isTopLevel()
Test whether this is a top-level element
-
bindVariable
public XSLVariableDeclaration bindVariable(int fingerprint) throws StaticError
Bind a variable used in this element to the compiled form of the XSLVariable element in which it is declared- Parameters:
fingerprint- The fingerprint of the name of the variable- Returns:
- the XSLVariableDeclaration (that is, an xsl:variable or xsl:param instruction) for the variable
- Throws:
StaticError- if the variable has not been declared
-
getStylesheetFunction
public XSLFunction getStylesheetFunction(int fingerprint, int arity)
Get a FunctionCall declared using an xsl:function element in the stylesheet- Parameters:
fingerprint- the fingerprint of the name of the functionarity- the number of arguments in the function call. The value -1 indicates that any arity will do (this is used to support the function-available() function).- Returns:
- the XSLFunction object representing the function declaration in the stylesheet, or null if no such function is defined.
-
getConstructType
public int getConstructType()
Get the type of construct. This will be a constant in classLocation. This method is part of theInstructionInfointerface- Specified by:
getConstructTypein interfaceInstructionInfo
-
getObjectNameCode
public int getObjectNameCode()
Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc. This is used only where the name is known statically. If there is no name, the value will be -1.- Specified by:
getObjectNameCodein interfaceInstructionInfo
-
getObjectFingerprint
public int getObjectFingerprint()
Get a fingerprint identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc. This is used only where the name is known statically. If there is no name, the value will be -1.
-
setObjectNameCode
public void setObjectNameCode(int nameCode)
Set the object name code
-
getNamespaceResolver
public NamespaceResolver getNamespaceResolver()
Get the namespace context of the instruction.- Specified by:
getNamespaceResolverin interfaceInstructionInfo
-
getProperty
public java.lang.Object getProperty(java.lang.String name)
Get the value of a particular property of the instruction. This is part of theInstructionInfointerface for run-time tracing and debugging. The properties available include all the attributes of the source instruction (named by the attribute name): these are all provided as string values.- Specified by:
getPropertyin interfaceInstructionInfo- Parameters:
name- The name of the required property- Returns:
- The value of the requested property, or null if the property is not available
-
getProperties
public java.util.Iterator getProperties()
Get an iterator over all the properties available. The values returned by the iterator will be of type String, and each string can be supplied as input to the getProperty() method to retrieve the value of the property.- Specified by:
getPropertiesin interfaceInstructionInfo
-
getSystemId
public java.lang.String getSystemId(int locationId)
Description copied from interface:LocationProviderGet the URI of the document or module containing a particular location- Specified by:
getSystemIdin interfaceLocationProvider- Parameters:
locationId- identifier of the location in question (as passed down the Receiver pipeline)- Returns:
- the URI of the document or module.
-
getLineNumber
public int getLineNumber(int locationId)
Description copied from interface:LocationProviderGet the line number within the document or module containing a particular location- Specified by:
getLineNumberin interfaceLocationProvider- Parameters:
locationId- identifier of the location in question (as passed down the Receiver pipeline)- Returns:
- the line number within the document or module.
-
getHostLanguage
public int getHostLanguage()
Get the host language (XSLT, XQuery, XPath) used to implement the code in this container- Specified by:
getHostLanguagein interfaceContainer- Returns:
- typically
Configuration.XSLTorConfiguration.XQUERY
-
replaceSubExpression
public boolean replaceSubExpression(Expression original, Expression replacement)
Replace one subexpression by a replacement subexpression- Specified by:
replaceSubExpressionin interfaceContainer- Parameters:
original- the original subexpressionreplacement- the replacement subexpression- Returns:
- true if the original subexpression is found
-
-