public class NamedTemplate extends ComponentCode<NamedTemplate>
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.
body
Constructor and Description |
---|
NamedTemplate()
Create a named template
|
Modifier and Type | Method and Description |
---|---|
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.
|
Expression |
getInterpretedBody() |
LocalParam |
getLocalParam(StructuredQName id)
Get the local parameter with a given parameter id
|
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 |
isMayOmitContextItem() |
boolean |
isMaySupplyContextItem() |
void |
setBody(Expression body)
Set the expression that forms the body of the template
|
void |
setContextItemRequirements(ItemType type,
boolean mayBeOmitted,
boolean mayBeSupplied)
Set the required context item type.
|
void |
setHasRequiredParams(boolean has)
Set whether this template has one or more required parameters
|
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, makeDeclaringComponent, saveLocation, setDeclaredVisibility, setDeclaringComponent, setLineNumber, setPackageData, setRetainedStaticContext, setStackFrameMap, setSystemId
public void setTemplateName(StructuredQName templateName)
templateName
- the name of the template (if any)
performed by apply-importspublic void setContextItemRequirements(ItemType type, boolean mayBeOmitted, boolean mayBeSupplied)
type
- the required context item typemayBeOmitted
- true if the context item may be absentmayBeSupplied
- true if the context item may be suppliedpublic int getComponentKind()
ComponentCode
StandardNames.XSL_FUNCTION
getComponentKind
in class ComponentCode<NamedTemplate>
public SymbolicName getSymbolicName()
ComponentCode
getSymbolicName
in class ComponentCode<NamedTemplate>
public void setBody(Expression body)
setBody
in class ComponentCode<NamedTemplate>
body
- the body of the templatepublic StructuredQName getTemplateName()
public StructuredQName getObjectName()
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 isMaySupplyContextItem()
public 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)
export
in class ComponentCode<NamedTemplate>
presenter
- the expression presenter used to generate the XML representation of the structurepublic void explainProperties(ExpressionPresenter presenter)
public Expression getInterpretedBody()
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.