public class NamedTemplate extends Actor
From Saxon 9.7, the NamedTemplate and TemplateRule objects are separated. A NamedTemplate represents a template with a name attribute; a TemplateRule is a template with a match attribute. If an xsl:template declaration has both attributes, two objects are created.
Modifier and Type | Class and Description |
---|---|
static class |
NamedTemplate.LocalParamInfo |
Constructor and Description |
---|
NamedTemplate(StructuredQName templateName)
Create a named template
|
Modifier and Type | Method and Description |
---|---|
void |
addLocalParam(LocalParam param) |
TailCall |
expand(XPathContext context)
Expand the template.
|
void |
explainProperties(ExpressionPresenter presenter) |
void |
export(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.
|
LocalParam |
getLocalParam(StructuredQName id)
Get the local parameter with a given parameter id
|
java.util.List<NamedTemplate.LocalParamInfo> |
getLocalParamDetails() |
java.util.List<LocalParam> |
getLocalParams() |
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.
|
ItemType |
getRequiredContextItemType() |
SequenceType |
getRequiredType()
Get the required type to be returned by this template
|
SymbolicName |
getSymbolicName()
Get the symbolic name of the component
|
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 |
isAbsentFocus() |
boolean |
isMayOmitContextItem() |
void |
resetLocalParams() |
void |
setBody(Expression body)
Set the expression that forms the body of the template
|
void |
setContextItemRequirements(ItemType type,
boolean mayBeOmitted,
boolean absentFocus)
Set the required context item type.
|
void |
setHasRequiredParams(boolean has)
Set whether this template has one or more required parameters
|
void |
setLocalParamDetails(java.util.List<NamedTemplate.LocalParamInfo> details) |
void |
setRequiredType(SequenceType type)
Set the required type to be returned by this template
|
void |
setTemplateName(StructuredQName templateName)
Initialize the template
|
allocateAllBindingSlots, allocateBindingSlotsRecursive, getBody, getColumnNumber, getDeclaredVisibility, getDeclaringComponent, getLineNumber, getLocation, getPackageData, getProperties, getProperty, getPublicId, getRetainedStaticContext, getStackFrameMap, getSystemId, isExportable, makeDeclaringComponent, saveLocation, setChildExpression, setDeclaredVisibility, setDeclaringComponent, setLineNumber, setPackageData, setRetainedStaticContext, setStackFrameMap, setSystemId
public NamedTemplate(StructuredQName templateName)
public void setTemplateName(StructuredQName templateName)
templateName
- the name of the template (if any)
performed by apply-importspublic void setContextItemRequirements(ItemType type, boolean mayBeOmitted, boolean absentFocus)
type
- the required context item typemayBeOmitted
- true if the context item may be absentabsentFocus
- true if the context item is treated as absent even if supplied (use=absent)public int getComponentKind()
Actor
StandardNames.XSL_FUNCTION
getComponentKind
in class Actor
public SymbolicName getSymbolicName()
Actor
getSymbolicName
in class Actor
public void setBody(Expression body)
public StructuredQName getTemplateName()
public StructuredQName getObjectName()
public void resetLocalParams()
public void addLocalParam(LocalParam param)
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 ItemType getRequiredContextItemType()
public boolean isMayOmitContextItem()
public boolean isAbsentFocus()
public java.util.List<LocalParam> getLocalParams()
public LocalParam getLocalParam(StructuredQName id)
id
- the parameter idpublic 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 LocationKind
.public void export(ExpressionPresenter presenter) throws XPathException
export
in class Actor
presenter
- the expression presenter used to generate the XML representation of the structureXPathException
public void explainProperties(ExpressionPresenter presenter) throws XPathException
XPathException
public void setLocalParamDetails(java.util.List<NamedTemplate.LocalParamInfo> details)
public java.util.List<NamedTemplate.LocalParamInfo> getLocalParamDetails()
Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.