public class Template extends Procedure implements RuleTarget
Constructor and Description |
---|
Template()
Create a template
|
Modifier and Type | Method and Description |
---|---|
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 |
getConstructType()
Get the type of construct.
|
LocalParam |
getLocalParam(int id)
Get the local parameter with a given parameter id
|
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
|
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 |
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
|
getBody, getColumnNumber, getColumnNumber, getContainerGranularity, getExecutable, getHostLanguage, getLineNumber, getLineNumber, getLocationProvider, getProperties, getProperty, getPublicId, getStackFrameMap, getSystemId, getSystemId, setExecutable, setHostLanguage, setLineNumber, setStackFrameMap, setSystemId
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 Pattern getMatchPattern()
public void setBody(Expression body)
public StructuredQName getTemplateName()
public 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 setDeclaredStreamable(boolean streamable)
streamable
- true if the template belongs to a streamable modepublic boolean isDeclaredStreamable()
public LocalParam getLocalParam(int 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
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 messagesCopyright (c) 2004-2013 Saxonica Limited. All rights reserved.