public final class XSLTemplate extends StyleElement implements StylesheetComponent
ACTION_COMPILE, ACTION_FIXUP, ACTION_OPTIMIZE, ACTION_PROCESS_ATTRIBUTES, ACTION_TYPECHECK, ACTION_VALIDATE, actionsCompleted, defaultCollationName, defaultMode, defaultXPathNamespace, expandText, extensionNamespaces, IGNORED_INSTRUCTION, REPORT_ALWAYS, REPORT_DYNAMICALLY_UNLESS_FALLBACK_AVAILABLE, REPORT_IF_INSTANTIATED, REPORT_STATICALLY_UNLESS_FALLBACK_AVAILABLE, REPORT_UNLESS_FORWARDS_COMPATIBLE, reportingCircumstances, staticContext, validationError, version, YES_NONODE_LETTERIS_DTD_TYPE, IS_NILLED| Constructor and Description |
|---|
XSLTemplate() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addChild(NodeImpl node,
int index)
Add a child node to this node.
|
void |
allocatePatternSlotNumbers()
Allocate slot numbers to any local variables declared within a predicate within the match pattern
|
void |
checkCompatibility(Component component)
Check the compatibility of this component with another component that it is overriding
|
void |
compact(int size)
Compact the space used by this node
|
void |
compileDeclaration(Compilation compilation,
ComponentDeclaration decl)
Compile: creates the executable form of the template
|
void |
compileTemplateRule(Compilation compilation,
Expression body,
ComponentDeclaration decl) |
void |
generateByteCode(Optimizer opt)
Generate byte code for the template (if appropriate)
|
NamedTemplate |
getActor()
Get the corresponding NamedTemplate object that results from the compilation of this
StylesheetComponent
|
java.util.Set<Mode> |
getApplicableModes()
Get the modes to which this template rule applies
|
NamedTemplate |
getCompiledNamedTemplate()
Get the compiled template
|
int |
getConstructType()
Get the type of construct.
|
ItemType |
getContextItemTypeForTemplateRule() |
NodeImpl |
getFirstChild()
Get the first child node of the element
|
NodeImpl |
getLastChild()
Get the last child node of the element
|
Pattern |
getMatch() |
StructuredQName[] |
getModeNames()
Return the list of mode names to which this template rule is applicable.
|
protected NodeImpl |
getNthChild(int n)
Get the nth child node of the element (numbering from 0)
|
int |
getNumberOfChildren()
Determine how many children the node has
|
XSLLocalParam |
getParam(StructuredQName name) |
protected int |
getRawSequenceNumber() |
ItemType |
getRequiredContextItemType() |
protected long |
getSequenceNumber()
Get the node sequence number (in document order).
|
SlotManager |
getSlotManager()
Get associated Procedure (for details of stack frame)
|
java.lang.String |
getStringValue()
Return the string-value of the node, that is, the concatenation
of the character content of all descendent elements and text nodes.
|
java.lang.CharSequence |
getStringValueCS()
Get the value of the item as a CharSequence.
|
SymbolicName |
getSymbolicName()
Get the symbolic name of the component, that is, the combination of the component kind and
the qualified name
|
StructuredQName |
getTemplateName()
Return the name of this template.
|
java.util.Map<StructuredQName,TemplateRule> |
getTemplateRulesByMode() |
boolean |
hasChildNodes()
Determine if the node has any children.
|
void |
index(ComponentDeclaration decl,
PrincipalStylesheetModule top)
Method supplied by declaration elements to add themselves to a stylesheet-level index
|
void |
insertChildren(NodeInfo[] source,
boolean atStart,
boolean inherit)
Insert a sequence of nodes as children of this node.
|
protected void |
insertChildrenAt(NodeInfo[] source,
int index,
boolean inherit)
Insert children before or after a given existing child
|
boolean |
isDeclaration()
Ask whether this node is a declaration, that is, a permitted child of xsl:stylesheet
(including xsl:include and xsl:import).
|
boolean |
isDeferredCompilation(Compilation compilation)
Ask whether the compilation of the template should be deferred
|
boolean |
isMayOmitContextItem() |
boolean |
isOmniMode()
Ask whether this is a template rule with mode="#all
|
protected boolean |
isPermittedChild(StyleElement child)
Specify that xsl:param and xsl:context-item are permitted children
|
protected boolean |
isWithinDeclaredStreamableConstruct() |
protected AxisIterator |
iterateChildren(NodeTest test)
Get an enumeration of the children of this node
|
void |
jitCompile(Compilation compilation,
ComponentDeclaration decl)
Code executed when the template is first executed under JIT.
|
boolean |
markTailCalls()
Mark tail-recursive calls on templates and functions.
|
protected boolean |
mayContainParam()
Determine whether this type of element is allowed to contain an xsl:param element
|
boolean |
mayContainSequenceConstructor()
Determine whether this type of element is allowed to contain a template-body
|
void |
optimize(ComponentDeclaration declaration)
This method is a bit of a misnomer, because it does more than invoke optimization of the template body.
|
void |
prepareAttributes()
Set the attribute list for the element.
|
void |
processAllAttributes()
Process the attributes of this element and all its children
|
void |
register(ComponentDeclaration declaration)
Registers the template rule with each Mode that it belongs to.
|
protected void |
removeChild(NodeImpl child)
Remove a given child
|
protected void |
replaceChildrenAt(NodeInfo[] source,
int index,
boolean inherit)
Replace child at a given index by new children
|
protected void |
setChildren(java.lang.Object children)
Set the children of this node
|
void |
setCompilation(Compilation compilation) |
void |
setContextItemRequirements(ItemType type,
boolean mayBeOmitted,
boolean absentFocus)
Set the required context item type.
|
protected void |
setRawSequenceNumber(int seq) |
void |
validate(ComponentDeclaration decl)
Check that the stylesheet element is valid.
|
void |
validateSubtree(ComponentDeclaration decl,
boolean excludeStylesheet)
Recursive walk through the stylesheet to validate all nodes
|
allocateLocalSlots, allocateLocation, bindLocalVariable, bindVariable, changesRetainedStaticContext, checkAttributeValue, checkEmpty, checkSortComesFirst, checkTopLevel, checkUnknownAttribute, compile, compileContentValueTemplate, compileError, compileError, compileError, compileError, compileError, compileErrorInAttribute, compileSequenceConstructor, compileSequenceConstructor, compileWarning, compileWarning, definesExcludedNamespace, definesExtensionElement, fallbackProcessing, findAncestorElement, findCollation, fixupReferences, forwardsCompatibleModeIsEnabled, generateId, getAttributeValue, getBaseURI, getBindingInformation, getCompilation, getConfiguration, getContainingPackage, getContainingSlotManager, getContainingStylesheet, getDeclaredVisibility, getDefaultCollationName, getDefaultMode, getDefaultValidation, getDefaultXPathNamespace, getEffectiveVersion, getEffectiveVersionAsString, getLastChildInstruction, getNamespaceResolver, getObjectName, getOverriddenComponent, getPackageData, getPrincipalStylesheetModule, getProperties, getProperty, getSchemaType, getStaticContext, getStaticContext, getTypeAnnotation, getUsedAttributeSets, getUsedPackage, getVisibility, getWithParamInstructions, getXslOriginal, hasImplicitBinding, interpretVisibilityValue, invalidAttribute, isActionCompleted, isConstructingComplexContent, isExcludedNamespace, isExpandingText, isExtensionNamespace, isInstruction, isSchemaAware, issueWarning, issueWarning, isTopLevel, makeAttributeValueTemplate, makeExpression, makeExpressionVisitor, makeExtendedSequenceType, makeNamespaceContext, makePattern, makeQName, makeRetainedStaticContext, makeSequenceType, makeSortKeys, makeTraceInstruction, mayContainFallback, postValidate, processAttributes, processBooleanAttribute, processDefaultCollationAttribute, processDefaultMode, processDefaultValidationAttribute, processDefaultXPathNamespaceAttribute, processExcludedNamespaces, processExpandTextAttribute, processExtensionElementAttribute, processStandardAttributes, processVersionAttribute, reportAbsence, seesAvuncularVariables, setActionCompleted, setIgnoreInstruction, setObjectName, setValidationError, substituteFor, typeCheck, typeCheck, undeclaredNamespaceError, validateChildren, validateValidationAttribute, xPath10ModeIsEnabledaddAttribute, addNamespace, copy, delete, fixupInsertedNamespaces, generateId, getAttributeList, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getLineNumber, getNamespaceList, getNodeKind, getNodeName, getRoot, getSchemaType, getSystemId, getURIForPrefix, gsetAttributeCollection, initialise, isId, isIdref, isInScopeNamespace, isNilled, iteratePrefixes, removeAttribute, removeTypeAnnotation, rename, replaceStringValue, setAttributeList, setLocation, setNamespaceDeclarations, setNamespaceList, setNilled, setNodeName, setSystemId, setTypeAnnotationatomize, compareOrder, effectiveBooleanValue, equals, getDisplayName, getFingerprint, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPhysicalRoot, getPrefix, getPreviousInDocument, getPreviousSibling, getRawParent, getSiblingPosition, getSuccessorElement, getTreeInfo, getURI, hasFingerprint, head, insertSiblings, isDeleted, iterate, iterateAxis, iterateAxis, newBuilder, replace, saveLocation, setRawParent, setSiblingPositionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequals, getGenre, getPublicId, hashCode, isSameNodeInfo, isStreamed, toShortStringgetLength, itemAt, iterator, reduce, subsequence, toGroundedValueasIterable, materializemakeRepeatablepublic NamedTemplate getActor()
getActor in interface StylesheetComponentpublic void setCompilation(Compilation compilation)
setCompilation in class StyleElementpublic boolean isDeclaration()
isDeclaration in class StyleElementpublic boolean isDeferredCompilation(Compilation compilation)
compilation - the compilationpublic boolean mayContainSequenceConstructor()
mayContainSequenceConstructor in class StyleElementprotected boolean mayContainParam()
StyleElementmayContainParam in class StyleElementprotected boolean isWithinDeclaredStreamableConstruct()
isWithinDeclaredStreamableConstruct in class StyleElementpublic void setContextItemRequirements(ItemType type, boolean mayBeOmitted, boolean absentFocus)
type - the required context item typemayBeOmitted - true if the context item may be absentabsentFocus - true if use=absent is specifiedprotected boolean isPermittedChild(StyleElement child)
isPermittedChild in class StyleElementchild - the child that may or may not be permittedpublic StructuredQName getTemplateName()
public SymbolicName getSymbolicName()
StylesheetComponentgetSymbolicName in interface StylesheetComponentpublic ItemType getRequiredContextItemType()
public boolean isMayOmitContextItem()
public void checkCompatibility(Component component)
StylesheetComponentcheckCompatibility in interface StylesheetComponentcomponent - the overridden componentpublic XSLLocalParam getParam(StructuredQName name)
public void prepareAttributes()
throws XPathException
StyleElementprepareAttributes in class StyleElementXPathException - if a static error is detectedpublic void processAllAttributes()
throws XPathException
StyleElementprocessAllAttributes in class StyleElementXPathException - in the event of a static error being detectedpublic StructuredQName[] getModeNames() throws XPathException
Mode.UNNAMED_MODE_NAME. The token #all translates to
Mode.OMNI_MODE.XPathException - if the attribute is invalid.public java.util.Set<Mode> getApplicableModes() throws XPathException
XPathException - should not happenpublic boolean isOmniMode()
throws XPathException
XPathExceptionpublic void validate(ComponentDeclaration decl) throws XPathException
StyleElementvalidate in class StyleElementdecl - the declaration to be validatedXPathException - if any error is found during validationpublic void validateSubtree(ComponentDeclaration decl, boolean excludeStylesheet) throws XPathException
StyleElementvalidateSubtree in class StyleElementdecl - the declaration to be validatedexcludeStylesheet - true if the XSLStylesheet element is to be excludedXPathException - if validation failspublic void index(ComponentDeclaration decl, PrincipalStylesheetModule top) throws XPathException
StyleElementindex in class StyleElementdecl - the Declaration being indexed. (This corresponds to the StyleElement object
except in cases where one module is imported several times with different precedence.)top - represents the outermost XSLStylesheet or XSLPackage elementXPathException - if any error is encounteredpublic boolean markTailCalls()
markTailCalls in class StyleElementpublic void compileDeclaration(Compilation compilation, ComponentDeclaration decl) throws XPathException
compileDeclaration in class StyleElementcompilation - the compilation episodedecl - the containing top-level declaration, for example xsl:function or xsl:templateXPathException - if compilation failspublic void compileTemplateRule(Compilation compilation, Expression body, ComponentDeclaration decl)
public void jitCompile(Compilation compilation, ComponentDeclaration decl) throws XPathException
compilation - the compilation episodedecl - the template rule declarationXPathException - if anything goes wrongpublic void register(ComponentDeclaration declaration) throws XPathException
declaration - Associates this template with a stylesheet module (in principle an xsl:template
element can be in a document that is imported more than once; these are separate declarations)XPathException - if a failure occurspublic void allocatePatternSlotNumbers()
public void optimize(ComponentDeclaration declaration) throws XPathException
optimize in interface StylesheetComponentdeclaration - Associates this template with a stylesheet module (in principle an xsl:template
element can be in a document that is imported more than once; these are separate declarations)XPathException - if errors are foundpublic ItemType getContextItemTypeForTemplateRule() throws XPathException
XPathExceptionpublic void generateByteCode(Optimizer opt) throws XPathException
generateByteCode in interface StylesheetComponentopt - the optimizerXPathException - if byte code generation failspublic SlotManager getSlotManager()
getSlotManager in interface StylesheetComponentpublic NamedTemplate getCompiledNamedTemplate()
public int getConstructType()
LocationKind. This method is part of the InstructionInfo interfacegetConstructType in class StyleElementpublic Pattern getMatch()
public java.util.Map<StructuredQName,TemplateRule> getTemplateRulesByMode()
protected final long getSequenceNumber()
getSequenceNumber in class NodeImplprotected final int getRawSequenceNumber()
protected final void setRawSequenceNumber(int seq)
protected final void setChildren(java.lang.Object children)
children - null if there are no children, a single NodeInfo if there is one child, an array of NodeInfo
if there are multiple childrenpublic final boolean hasChildNodes()
hasChildNodes in interface NodeInfohasChildNodes in class NodeImpltrue if the node has any children,
false if the node has no children.public final int getNumberOfChildren()
protected final AxisIterator iterateChildren(NodeTest test)
test - A NodeTest to be satisfied by the child nodes, or null
if all child node are to be returnedpublic final NodeImpl getFirstChild()
getFirstChild in interface SteppingNode<NodeImpl>getFirstChild in class NodeImplpublic final NodeImpl getLastChild()
getLastChild in class NodeImplprotected final NodeImpl getNthChild(int n)
n - identifies the required childprotected void removeChild(NodeImpl child)
child - the child to be removedpublic java.lang.String getStringValue()
Item.getStringValueCS()public java.lang.CharSequence getStringValueCS()
NodeImplgetStringValueCS in interface GroundedValue<NodeInfo>getStringValueCS in interface Item<NodeInfo>getStringValueCS in class NodeImplItem.getStringValue()protected void addChild(NodeImpl node, int index)
node - the node to be added as a child of this node. This must be an instance of
NodeImpl. It will be modified as a result of this call (by setting its
parent property and sibling position)index - the position where the child is to be addedpublic void insertChildren(NodeInfo[] source, boolean atStart, boolean inherit)
This method takes no action unless the target node is a document node or element node. It also takes no action in respect of any supplied nodes that are not elements, text nodes, comments, or processing instructions.
The supplied nodes will form the new children. Adjacent text nodes will be merged, and zero-length text nodes removed. The supplied nodes may be modified in situ, for example to change their parent property and to add namespace bindings, or they may be copied, at the discretion of the implementation.
insertChildren in interface MutableNodeInfoinsertChildren in class NodeImplsource - the nodes to be inserted. The implementation determines what implementation classes
of node it will accept; this implementation will accept text, comment, and processing instruction
nodes belonging to any implementation, but elements must be instances of ElementImpl.
The supplied nodes will be modified in situ, for example
to change their parent property and to add namespace bindings, if they are instances of
ElementImpl; otherwise they will be copied. If the nodes are copied, then on return
the supplied source array will contain the copy rather than the original.atStart - true if the new nodes are to be inserted before existing children; false if they are
to be inserted after existing childreninherit - true if the inserted nodes are to inherit the namespaces of their new parent; false
if such namespaces are to be undeclaredjava.lang.IllegalArgumentException - if the supplied nodes use a node implementation that this
implementation does not accept.protected void insertChildrenAt(NodeInfo[] source, int index, boolean inherit)
source - the children to be inserted. We allow any kind of text, comment, or processing instruction
node, but element nodes must be instances of this NodeInfo implementation.index - the position before which they are to be inserted: 0 indicates insertion before the
first child, 1 insertion before the second child, and so on.inherit - true if the inserted nodes are to inherit the namespaces that are in-scope for their
new parent; false if such namespaces should be undeclared on the childrenprotected void replaceChildrenAt(NodeInfo[] source, int index, boolean inherit)
source - the children to be insertedindex - the position at which they are to be inserted: 0 indicates replacement of the
first child, replacement of the second child, and so on. The effect is undefined if index
is out of rangeinherit - set to true if the new child elements are to inherit the in-scope namespaces
of their new parentjava.lang.IllegalArgumentException - if any of the replacement nodes is not an element, text,
comment, or processing instruction nodepublic void compact(int size)
size - the number of actual childrenCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.