public class Template extends ComponentBody implements RuleTarget
body
Constructor and Description |
---|
Template()
Create a template
|
Modifier and Type | Method and Description |
---|---|
void |
allocateAllBindingSlots(StylesheetPackage pack)
Allocate slot numbers to all the external component references in this procedure
|
void |
apply(XPathContextMajor context)
Process the template, without returning any tail calls.
|
TailCall |
applyLeavingTail(XPathContextMajor context)
Process this template, with the possibility of returning a tail call package if the template
contains any tail calls that are to be performed by the caller.
|
TailCall |
expand(XPathContext context)
Expand the template.
|
void |
explain(ExpressionPresenter presenter)
Output diagnostic explanation to an ExpressionPresenter
|
int |
getComponentKind()
Get the kind of component that this represents, using integer constants such as
StandardNames.XSL_FUNCTION |
int |
getConstructType()
Get the type of construct.
|
Expression |
getInterpretedBody() |
TemplateInversion |
getInversion() |
LocalParam |
getLocalParam(StructuredQName id)
Get the local parameter with a given parameter id
|
List<LocalParam> |
getLocalParams() |
Pattern |
getMatchPattern()
Get the match pattern used with this template
|
StructuredQName[] |
getModeNames()
Get the names of the modes associated with this template rule
|
StructuredQName |
getObjectName()
Get a name identifying the object of the expression, for example a function name, template name,
variable name, key name, element name, etc.
|
SequenceType |
getRequiredType()
Get the required type to be returned by this template
|
SymbolicName |
getSymbolicName() |
StructuredQName |
getTemplateName()
Get the name of the template (if it is named)
|
boolean |
hasRequiredParams()
Ask whether this template has one or more required parameters
|
boolean |
isActuallyStreamable(boolean allowExtensions,
List<String> reasons)
Ask whether this template satisfies the rules for a guaranteed streamable template
|
boolean |
isDeclaredStreamable()
Ask whether or not this template is declared as streamable
|
void |
makeInversion(Pattern pattern,
Template template)
Generate the inversion of the expression comprising the body of a template rules.
|
void |
regiaterRule(Rule rule)
Register a rule for which this is the target
|
void |
setBody(Expression body)
Set the expression that forms the body of the template
|
void |
setDeclaredStreamable(boolean streamable)
Say whether or not this template is declared as streamable
|
void |
setHasRequiredParams(boolean has)
Set whether this template has one or more required parameters
|
void |
setMatchPattern(Pattern pattern)
Set the match pattern used with this template
|
void |
setModeNames(StructuredQName[] modeNames)
Set the names of the modes associated with this template rule
|
void |
setRequiredType(SequenceType type)
Set the required type to be returned by this template
|
void |
setTemplateName(StructuredQName templateName)
Initialize the template
|
allocateBindingSlotsRecursive, getBody, getColumnNumber, getConfiguration, getContainerGranularity, getDeclaringComponent, getHostLanguage, getLineNumber, getLocationProvider, getPackageData, getProperties, getProperty, getPublicId, getStackFrameMap, getSystemId, makeDeclaringComponent, setHostLanguage, setLineNumber, setPackageData, setStackFrameMap, setSystemId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDeclaringComponent
public void setTemplateName(StructuredQName templateName)
templateName
- the name of the template (if any)
performed by apply-importspublic void setMatchPattern(Pattern pattern)
pattern
- the match pattern (may be null for a named template)public int getComponentKind()
ComponentBody
StandardNames.XSL_FUNCTION
getComponentKind
in class ComponentBody
public SymbolicName getSymbolicName()
public Pattern getMatchPattern()
public void setBody(Expression body)
setBody
in class ComponentBody
body
- the body of the templatepublic StructuredQName getTemplateName()
public void allocateAllBindingSlots(StylesheetPackage pack)
ComponentBody
allocateAllBindingSlots
in class ComponentBody
pack
- the containing packagepublic StructuredQName getObjectName()
getObjectName
in interface InstructionInfo
public void setHasRequiredParams(boolean has)
has
- true if the template has at least one required parameterpublic boolean hasRequiredParams()
public void setRequiredType(SequenceType type)
type
- the required type as defined in the "as" attribute on the xsl:template elementpublic SequenceType getRequiredType()
public void setModeNames(StructuredQName[] modeNames)
modeNames
- the names of the modes for this template rulepublic StructuredQName[] getModeNames()
public void regiaterRule(Rule rule)
regiaterRule
in interface RuleTarget
rule
- a rule in which this is the targetpublic void setDeclaredStreamable(boolean streamable)
streamable
- true if the template belongs to a streamable mode; set to false if it does not belong
to a streamable mode, or if it is found that the template is not actually streamable, and fallback
to non-streaming has been requested.public boolean isDeclaredStreamable()
public List<LocalParam> getLocalParams()
public LocalParam getLocalParam(StructuredQName id)
id
- the parameter idpublic void apply(XPathContextMajor context) throws XPathException
context
- The dynamic context, giving access to the current node,XPathException
- if a dynamic error occurs while evaluating
the templatepublic TailCall applyLeavingTail(XPathContextMajor context) throws XPathException
context
- the XPath dynamic contextXPathException
- if a dynamic error occurs while evaluating
the templatepublic TailCall expand(XPathContext context) throws XPathException
context
- the XPath dynamic contextXPathException
- if a dynamic error occurs while evaluating
the templatepublic int getConstructType()
StandardNames
: all less than 1024)
or it will be a constant in class Location
.getConstructType
in interface InstructionInfo
public void explain(ExpressionPresenter presenter)
explain
in interface RuleTarget
presenter
- the destination for the explanationpublic Expression getInterpretedBody()
public boolean isActuallyStreamable(boolean allowExtensions, List<String> reasons)
allowExtensions
- if true, the method tests for streamability against the Saxon
rules rather than the W3C rulesreasons
- the caller may supply a list which on return will contain explanations
for why the template is not streamable, suitable for inclusion in error messagespublic void makeInversion(Pattern pattern, Template template) throws XPathException
pattern
- the match pattern of this template ruletemplate
- the template to be invertedXPathException
public TemplateInversion getInversion()
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.