java.io.Serializable
, javax.xml.transform.SourceLocator
, LocationProvider
, SaxonLocator
, Container
, InstructionInfo
, org.xml.sax.Locator
public class Template extends Procedure
Constructor | Description |
---|---|
Template() |
Create a template
|
Modifier and Type | Method | Description |
---|---|---|
void |
apply(XPathContext context,
Rule rule) |
Process the template, without returning any tail calls.
|
TailCall |
applyLeavingTail(XPathContext context,
Rule rule) |
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.
|
int |
getConstructType() |
Get the type of construct.
|
Pattern |
getMatchPattern() |
Get the match pattern used with this template
|
int |
getMinImportPrecedence() |
Get the minimum import precedence used by xsl:apply-imports
|
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.
|
int |
getPrecedence() |
Get the import precedence of the template
|
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
|
void |
init(StructuredQName templateName,
int precedence,
int minImportPrecedence) |
Initialize the template
|
void |
setBody(Expression body) |
Set the expression that forms the body of the template
|
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 |
setRequiredType(SequenceType type) |
Set the required type to be returned by this template
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBody, getColumnNumber, getColumnNumber, getExecutable, getHostLanguage, getLineNumber, getLineNumber, getLocationProvider, getProperties, getProperty, getPublicId, getStackFrameMap, getSystemId, getSystemId, replaceSubExpression, setExecutable, setHostLanguage, setLineNumber, setStackFrameMap, setSystemId
public void init(StructuredQName templateName, int precedence, int minImportPrecedence)
templateName
- the name of the template (if any)precedence
- the import precedenceminImportPrecedence
- the minimum import precedence to be considered in the search
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()
public int getPrecedence()
public int getMinImportPrecedence()
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 apply(XPathContext context, Rule rule) throws XPathException
context
- The dynamic context, giving access to the current node,rule
- the template rule that caused this template to be invoked. When a template has
a match pattern defined as a union, there can be more than one Rule referring to the same template,
and further calls on next-match or apply-imports need to know which one in in forceXPathException
public TailCall applyLeavingTail(XPathContext context, Rule rule) throws XPathException
context
- the XPath dynamic contextrule
- the template rule that caused this template to be invoked. When a template has
a match pattern defined as a union, there can be more than one Rule referring to the same template,
and further calls on next-match or apply-imports need to know which one in in forceXPathException
public TailCall expand(XPathContext context) throws XPathException
context
- the XPath dynamic contextXPathException
public int getConstructType()
StandardNames
: all less than 1024)
or it will be a constant in class Location
.