public abstract class StyleElement extends ElementImpl
Note: this class implements Locator. The element retains information about its own location in the stylesheet, which is useful when an XSLT static error is found.
Modifier and Type | Field and Description |
---|---|
static int |
ACTION_COMPILE |
static int |
ACTION_FIXUP |
static int |
ACTION_OPTIMIZE |
static int |
ACTION_PROCESS_ATTRIBUTES |
static int |
ACTION_TYPECHECK |
static int |
ACTION_VALIDATE |
protected int |
actionsCompleted |
protected String |
defaultCollationName |
protected StructuredQName |
defaultMode |
protected String |
defaultXPathNamespace |
protected boolean |
expandText |
protected String[] |
extensionNamespaces |
static int |
REPORT_ALWAYS |
static int |
REPORT_IF_INSTANTIATED |
static int |
REPORT_UNLESS_FALLBACK_AVAILABLE |
static int |
REPORT_UNLESS_FORWARDS_COMPATIBLE |
protected int |
reportingCircumstances |
protected ExpressionContext |
staticContext |
protected XPathException |
validationError |
protected int |
version |
protected static String[] |
YES_NO |
NODE_LETTER
ALL_NAMESPACES, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES
Constructor and Description |
---|
StyleElement()
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addChild(NodeImpl node,
int index)
Add a child node to this node.
|
void |
addXSLOverrideFunctionLibrary(FunctionLibraryList list)
Add a function library that recognizes the function call xsl:original, which is permitted
within a function that overrides another
|
void |
allocateLocalSlots(Expression exp)
Allocate slots in the local stack frame to range variables used in an XPath expression
|
protected Location |
allocateLocation()
Allocate a location
|
SourceBinding |
bindLocalVariable(StructuredQName qName)
Bind a variable reference used in this element to the compiled form of the XSLVariable element in which it is
declared, considering only local variables and params
|
SourceBinding |
bindVariable(StructuredQName qName)
Bind a variable used in this element to the compiled form of the XSLVariable element in which it is
declared
|
boolean |
changesRetainedStaticContext()
Ask whether this instruction requires a different retained static context from the containing
(parent) instruction.
|
void |
check30attribute(String attName)
Check an attribute that is permitted under 3.0 but not under 2.0
|
protected void |
checkAttributeValue(String name,
String value,
boolean avt,
String[] allowed)
Check the value of an attribute, as supplied statically
|
void |
checkEmpty()
Convenience method to check that the stylesheet element is empty
|
protected void |
checkSortComesFirst(boolean sortRequired)
Check that among the children of this element, any xsl:sort elements precede any other elements
|
void |
checkTopLevel(String errorCode,
boolean allowOverride)
Convenience method to check that the stylesheet element is at the top level (that is,
as a child of xsl:stylesheet or xsl:transform)
|
protected void |
checkUnknownAttribute(NodeName nc)
Check whether an unknown attribute is permitted.
|
void |
compact(int size)
Compact the space used by this node
|
Expression |
compile(Compilation compilation,
ComponentDeclaration decl)
Compile the instruction on the stylesheet tree into an executable instruction
for use at run-time.
|
void |
compileDeclaration(Compilation compilation,
ComponentDeclaration decl)
Compile a declaration in the stylesheet tree
for use at run-time.
|
void |
compileError(String message)
Report a static error in the stylesheet
|
void |
compileError(String message,
String errorCode)
Compile time error, specifying an error code
|
void |
compileError(String message,
StructuredQName errorCode)
Compile time error, specifying an error code
|
void |
compileError(XPathException error)
Report an error with diagnostic information
|
void |
compileErrorInAttribute(String message,
String errorCode,
String attributeName)
Compile time error, specifying an error code and the name of the attribute that
is in error.
|
Expression |
compileSequenceConstructor(Compilation compilation,
ComponentDeclaration decl,
boolean includeParams)
Compile the children of this instruction on the stylesheet tree, adding the
subordinate instructions to the parent instruction on the execution tree.
|
Expression |
compileSequenceConstructor(Compilation compilation,
ComponentDeclaration decl,
SequenceIterator iter,
boolean includeParams)
Compile the children of this instruction on the stylesheet tree, adding the
subordinate instructions to the parent instruction on the execution tree.
|
void |
compileWarning(String message,
String errorCode) |
void |
compileWarning(String message,
StructuredQName errorCode) |
protected boolean |
definesExcludedNamespace(String uri)
Check whether this node excludes a particular namespace from the result.
|
protected boolean |
definesExtensionElement(String uri)
Check whether a particular extension element namespace is defined on this node.
|
protected Expression |
fallbackProcessing(Compilation exec,
ComponentDeclaration decl,
StyleElement instruction)
Perform fallback processing.
|
StyleElement |
findAncestorElement(int fingerprint)
Get the first ancestor element in the stylesheet tree that has a given name, supplied by
fingerprint.
|
StringCollator |
findCollation(String name,
String baseURI)
Find a named collation.
|
void |
fixupReferences()
Fix up references from XPath expressions.
|
boolean |
forwardsCompatibleModeIsEnabled()
Determine whether forwards-compatible mode is enabled for this element
|
protected String |
generateId() |
String |
getAttributeValue(String clarkName)
Get an attribute value given the Clark name of the attribute (that is,
the name in {uri}local format).
|
SourceBinding |
getBindingInformation(StructuredQName name)
Ask whether this element contains a binding for a variable with a given name; and if it does,
return the source binding information
|
Compilation |
getCompilation() |
int |
getConstructType()
Get the type of construct.
|
StylesheetPackage |
getContainingPackage()
Get the containing package (the principal stylesheet module of the package in which
this XSLT element appears)
|
SlotManager |
getContainingSlotManager()
Get the SlotManager for the containing Procedure definition
|
XSLModuleRoot |
getContainingStylesheet()
Get the containing XSLStylesheet or XSLPackage element
|
Visibility |
getDeclaredVisibility() |
protected String |
getDefaultCollationName()
Get the default collation for this stylesheet element.
|
StructuredQName |
getDefaultMode()
Get the default mode for this stylesheet element.
|
int |
getDefaultValidation()
Get the value of the default-validation attribute on the containing xsl:stylesheet element
|
protected String |
getDefaultXPathNamespace()
Get the default XPath namespace for elements and types
|
int |
getEffectiveVersion()
Get the numeric value of the version number appearing as an attribute on this element,
or inherited from its ancestors
|
NodeImpl |
getFirstChild()
Get the first child node of the element
|
int |
getHostLanguage()
Get the host language (XSLT, XQuery, XPath) used to implement the code in this container
|
NodeImpl |
getLastChild()
Get the last child node of the element
|
protected StyleElement |
getLastChildInstruction()
Find the last child instruction of this instruction.
|
Location |
getLocation() |
NamespaceResolver |
getNamespaceResolver()
Get the namespace context of the instruction.
|
protected NodeImpl |
getNthChild(int n)
Get the nth child node of the element (numbering from 0)
|
int |
getNumberOfChildren()
Determine how many children the node has
|
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.
|
Component |
getOverriddenComponent()
Get the component that this declaration overrides, or null if this is not an overriding declaration
|
StylesheetPackage |
getPackageData() |
PrincipalStylesheetModule |
getPrincipalStylesheetModule()
Get the principal stylesheet module of the package in which
this XSLT element appears
|
int |
getProcessorVersion()
Determine what version of the XSLT the configured processor supports
|
Iterator<String> |
getProperties()
Get an iterator over all the properties available.
|
Object |
getProperty(String name)
Get the value of a particular property of the instruction.
|
protected int |
getRawSequenceNumber() |
SchemaType |
getSchemaType(String typeAtt)
Get the Schema type definition for a type named in the stylesheet (in a
"type" attribute).
|
protected long |
getSequenceNumber()
Get the node sequence number (in document order).
|
ExpressionContext |
getStaticContext()
Get the static context for expressions on this element
|
ExpressionContext |
getStaticContext(StructuredQName attributeName) |
String |
getStringValue()
Return the string-value of the node, that is, the concatenation
of the character content of all descendent elements and text nodes.
|
CharSequence |
getStringValueCS()
Get the value of the item as a CharSequence.
|
SimpleType |
getTypeAnnotation(SchemaType schemaType)
Get the type annotation to use for a given schema type
|
protected StructuredQName[] |
getUsedAttributeSets(String use)
Get the list of attribute-set names associated with this element.
|
StylesheetPackage |
getUsedPackage()
Assuming this is an xsl:use-package element, find the package to which it refers.
|
Visibility |
getVisibility() |
protected WithParam[] |
getWithParamInstructions(Expression parent,
Compilation compilation,
ComponentDeclaration decl,
boolean tunnel)
Get the list of xsl:with-param elements for a calling element (apply-templates,
call-template, apply-imports, next-match).
|
ComponentCode |
getXslOriginal(int componentKind)
Check that a reference to xsl:original appears within an xsl:override element, and that
the name of the containing component matches the name of a component in the used stylesheet
package; return the component in that package with matching symbolic name
|
boolean |
hasChildNodes()
Determine if the node has any children.
|
protected SourceBinding |
hasImplicitBinding(StructuredQName name)
Ask whether this particular element implicitly binds a given variable (used for xsl:accumulator-rule)
|
void |
index(ComponentDeclaration decl,
PrincipalStylesheetModule top)
Method supplied by declaration elements to add themselves to a stylesheet-level index
|
void |
insertChildren(NodeInfo[] source,
boolean atStart,
boolean inherit)
Insert a sequence of nodes as children of this node.
|
protected void |
insertChildrenAt(NodeInfo[] source,
int index,
boolean inherit)
Insert children before or after a given existing child
|
protected Visibility |
interpretVisibilityValue(String s,
String flags)
Process the value of the visibility attribute (XSLT 3.0)
|
protected void |
invalidAttribute(String attributeName,
String allowedValues) |
boolean |
isActionCompleted(int action)
Ask if an action on this StyleElement has been completed
|
boolean |
isDeclaration()
Ask whether this node is a declaration, that is, a permitted child of xsl:stylesheet
(including xsl:include and xsl:import).
|
boolean |
isExcludedNamespace(String uri)
Check whether a namespace uri defines an namespace excluded from the result.
|
boolean |
isExpandingText()
Ask whether content value templates are available within this element
|
protected boolean |
isExplaining()
Determine whether saxon:explain has been set to "yes"
|
boolean |
isExtensionNamespace(String uri)
Check whether a namespace uri defines an extension element.
|
boolean |
isInstruction()
Ask whether this node is an instruction.
|
protected boolean |
isPermittedChild(StyleElement child)
Check whether a given child is permitted for this element.
|
boolean |
isSchemaAware()
Ask whether the code is compiled in schema-aware mode
|
protected void |
issueWarning(String message,
SourceLocator locator)
Report a warning to the error listener
|
protected void |
issueWarning(XPathException error)
Report a warning to the error listener
|
boolean |
isTopLevel()
Test whether this is a top-level element
|
boolean |
isXslt30Processor()
Ask whether the configured XSLT processor supports XSLT 3.0
|
protected AxisIterator |
iterateChildren(NodeTest test)
Get an enumeration of the children of this node
|
protected Expression |
makeAttributeValueTemplate(String expression,
int attIndex)
Make an attribute value template in the context of this stylesheet element
|
Expression |
makeExpression(String expression,
int attIndex)
Compile an XPath expression in the context of this stylesheet element
|
ExpressionVisitor |
makeExpressionVisitor()
Make an expression visitor
|
SavedNamespaceContext |
makeNamespaceContext()
Make a NamespaceContext object representing the list of in-scope namespaces.
|
Pattern |
makePattern(String pattern,
String attributeName)
Make a pattern in the context of this stylesheet element
|
StructuredQName |
makeQName(String lexicalQName)
Make a structured QName, using this Element as the context for namespace resolution.
|
RetainedStaticContext |
makeRetainedStaticContext() |
SequenceType |
makeSequenceType(String sequenceType)
Process an attribute whose value is a SequenceType
|
SortKeyDefinitionList |
makeSortKeys(Compilation compilation,
ComponentDeclaration decl)
Construct sort keys for a SortedIterator
|
protected static Expression |
makeTraceInstruction(StyleElement source,
Expression child)
Create a trace instruction to wrap a real instruction
|
protected boolean |
markTailCalls()
Mark tail-recursive calls on templates and functions.
|
protected boolean |
mayContainFallback()
Determine whether this type of element is allowed to contain an xsl:fallback
instruction.
|
protected boolean |
mayContainParam(String attName)
Determine whether this type of element is allowed to contain an xsl:param element
|
protected boolean |
mayContainSequenceConstructor()
Determine whether this type of element is allowed to contain a sequence constructor
|
void |
postValidate()
Hook to allow additional validation of a parent element immediately after its
children have been validated.
|
protected abstract void |
prepareAttributes()
Set the attribute list for the element.
|
void |
processAllAttributes()
Process the attributes of this element and all its children
|
protected void |
processAttributes()
Process the attribute list for the element.
|
boolean |
processBooleanAttribute(String name,
String value)
Process an attribute whose value is yes, no, true, false, 1, or 0; returning true or false.
|
protected void |
processDefaultCollationAttribute()
Process the [xsl:]default-collation attribute if there is one
|
protected void |
processDefaultMode()
Process the [xsl:]default-mode attribute if there is one
|
protected void |
processDefaultXPathNamespaceAttribute(String ns)
Process the [xsl:]xpath-default-namespace attribute if there is one
|
protected void |
processExcludedNamespaces(String ns)
Process the [xsl:]exclude-result-prefixes attribute if there is one
|
protected void |
processExpandTextAttribute(String ns)
Process the [xsl:]expand-text attribute if there is one (and if XSLT 3.0 is enabled)
|
protected void |
processExtensionElementAttribute(String ns)
Process the [xsl:]extension-element-prefixes attribute if there is one
|
void |
processStandardAttributes(String namespace)
Process the standard attributes such as [xsl:]default-collation
|
protected void |
processVersionAttribute(String ns)
Process the [xsl:]version attribute if there is one
|
protected void |
removeChild(NodeImpl child)
Remove a given child
|
protected void |
replaceChildrenAt(NodeInfo[] source,
int index,
boolean inherit)
Replace child at a given index by new children
|
void |
reportAbsence(String attribute)
Convenience method to report the absence of a mandatory attribute
|
protected boolean |
seesAvuncularVariables()
Ask whether variables declared in an "uncle" element are visible.
|
void |
setActionCompleted(int action)
Say that an action on this StyleElement has been completed
|
protected void |
setChildren(Object children)
Set the children of this node
|
void |
setCompilation(Compilation compilation) |
void |
setObjectName(StructuredQName qName)
Set the object name, for example the name of a function, variable, or template declared on this element
|
protected void |
setRawSequenceNumber(int seq) |
void |
setValidationError(TransformerException reason,
int circumstances)
Set a validation error.
|
void |
substituteFor(StyleElement temp)
Make this node a substitute for a temporary one previously added to the tree.
|
Expression |
typeCheck(String name,
Expression exp)
Type-check an expression.
|
Pattern |
typeCheck(String name,
Pattern pattern)
Type-check a pattern.
|
protected void |
undeclaredNamespaceError(String prefix,
String errorCode,
String attributeName) |
void |
validate(ComponentDeclaration decl)
Check that the stylesheet element is valid.
|
protected void |
validateChildren(ComponentDeclaration decl,
boolean excludeStylesheet)
Validate the children of this node, recursively.
|
void |
validateSubtree(ComponentDeclaration decl,
boolean excludeStylesheet)
Recursive walk through the stylesheet to validate all nodes
|
protected int |
validateValidationAttribute(String value)
Validate the value of the [xsl:]validation attribute
|
boolean |
xPath10ModeIsEnabled()
Determine whether 1.0-compatible mode is enabled for this element
|
addAttribute, addNamespace, copy, delete, fixupInsertedNamespaces, generateId, getAttributeList, getAttributeValue, getAttributeValue, getBaseURI, getColumnNumber, getDeclaredNamespaces, getLineNumber, getNamespaceList, getNodeKind, getNodeName, getRoot, getSchemaType, getSystemId, getURIForPrefix, gsetAttributeCollection, initialise, isId, isInScopeNamespace, isNilled, iteratePrefixes, removeAttribute, removeTypeAnnotation, rename, replaceStringValue, setAttributeList, setLocation, setNamespaceDeclarations, setNamespaceList, setNilled, setNodeName, setSystemId, setTypeAnnotation
atomize, compareOrder, comparePosition, equals, getConfiguration, getDisplayName, getFingerprint, getLocalPart, getNameCode, getNamePool, getNextInDocument, getNextSibling, getParent, getPhysicalRoot, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getRawParent, getSiblingPosition, getSuccessorElement, getTreeInfo, getURI, head, insertSiblings, isDeleted, isIdref, isSameNodeInfo, iterate, iterateAxis, iterateAxis, newBuilder, replace, saveLocation, setRawParent, setSiblingPosition
protected String[] extensionNamespaces
protected int version
protected ExpressionContext staticContext
protected XPathException validationError
protected int reportingCircumstances
protected String defaultXPathNamespace
protected String defaultCollationName
protected StructuredQName defaultMode
protected boolean expandText
public static final int REPORT_ALWAYS
public static final int REPORT_UNLESS_FORWARDS_COMPATIBLE
public static final int REPORT_IF_INSTANTIATED
public static final int REPORT_UNLESS_FALLBACK_AVAILABLE
protected int actionsCompleted
public static final int ACTION_VALIDATE
public static final int ACTION_COMPILE
public static final int ACTION_TYPECHECK
public static final int ACTION_OPTIMIZE
public static final int ACTION_FIXUP
public static final int ACTION_PROCESS_ATTRIBUTES
protected static final String[] YES_NO
public Compilation getCompilation()
public void setCompilation(Compilation compilation)
public StylesheetPackage getPackageData()
public ExpressionContext getStaticContext()
public ExpressionContext getStaticContext(StructuredQName attributeName)
public ExpressionVisitor makeExpressionVisitor()
public boolean isSchemaAware()
protected boolean isExplaining()
public void substituteFor(StyleElement temp)
temp
- the element which this one is substituting forpublic void setValidationError(TransformerException reason, int circumstances)
reason
- the details of the errorcircumstances
- a code identifying the circumstances under which the error is to be reportedpublic boolean isInstruction()
public boolean isDeclaration()
public Visibility getVisibility() throws XPathException
XPathException
public Visibility getDeclaredVisibility() throws XPathException
XPathException
protected boolean markTailCalls()
protected boolean mayContainSequenceConstructor()
protected boolean mayContainFallback()
protected boolean mayContainParam(String attName)
attName
- if null, the method tests whether an xsl:param child is allowed.
If non-null, it tests whether an xsl:param child with the given attribute name is allowedpublic XSLModuleRoot getContainingStylesheet()
public int getDefaultValidation()
Validation
class,
or Validation.STRIP if there is no containing xsl:stylesheet or if it has no default-validation
attribute.public final StructuredQName makeQName(String lexicalQName) throws XPathException, NamespaceException
lexicalQName
- The lexical QName as written, in the form "[prefix:]localname". The name must have
already been validated as a syntactically-correct QName. Leading and trailing whitespace
will be trimmed. If XSLT 3.0 is enabled, then the EQName syntax "Q{uri}local" is also
accepted.XPathException
- if the qname is not a lexically-valid QName, or if the name
is in a reserved namespace.NamespaceException
- if the prefix of the qname has not been declaredpublic void addXSLOverrideFunctionLibrary(FunctionLibraryList list)
list
- the function library list to which the new function library should be addedpublic StyleElement findAncestorElement(int fingerprint)
fingerprint
- the name of the required elementpublic StylesheetPackage getUsedPackage()
public ComponentCode getXslOriginal(int componentKind) throws XPathException
componentKind
- the kind of component required, e.g. StandardNames.XSL_TEMPLATEXPathException
public Component getOverriddenComponent()
public SavedNamespaceContext makeNamespaceContext()
public RetainedStaticContext makeRetainedStaticContext()
public boolean changesRetainedStaticContext()
public NamespaceResolver getNamespaceResolver()
public void processAllAttributes() throws XPathException
XPathException
- in the event of a static error being detectedpublic void processStandardAttributes(String namespace) throws XPathException
namespace
- either "" to find the attributes in the null namespace,
or NamespaceConstant.XSLT to find them in the XSLT namespaceXPathException
- if any of the standard attributes is incorrectpublic String getAttributeValue(String clarkName)
clarkName
- the name of the attribute in {uri}local formatprotected final void processAttributes() throws XPathException
XPathException
- if a static error is detectedprotected void checkUnknownAttribute(NodeName nc) throws XPathException
nc
- The name code of the attribute nameXPathException
- (and reports the error) if this is an attribute
that is not permitted on the containing elementpublic void check30attribute(String attName) throws XPathException
XPathException
protected abstract void prepareAttributes() throws XPathException
XPathException
- if a static error is detectedprotected StyleElement getLastChildInstruction()
public Expression makeExpression(String expression, int attIndex) throws XPathException
expression
- the source text of the XPath expressionattIndex
- the index position of the attribute containing the XPath expression, or
-1 if the expression is in a text nodeXPathException
- if a static error is detected in the XPath expressionpublic Pattern makePattern(String pattern, String attributeName) throws XPathException
pattern
- the source text of the patternXPathException
- if a static error is detected in the patternprotected Expression makeAttributeValueTemplate(String expression, int attIndex) throws XPathException
expression
- the source text of the attribute value templateXPathException
- if a static error is detected in the AVTpublic Location getLocation()
protected void checkAttributeValue(String name, String value, boolean avt, String[] allowed) throws XPathException
name
- the name of the attributevalue
- the value of the attributeavt
- set to true if the value is permitted to be an attribute value templateallowed
- list of permitted values, which must be in alphabetical orderXPathException
- if the value given for the attribute is not a permitted valuepublic boolean processBooleanAttribute(String name, String value) throws XPathException
name
- the name of the attribute (used for diagnostics)value
- the value of the attributeXPathException
- if the value is not one of the abovepublic SequenceType makeSequenceType(String sequenceType) throws XPathException
sequenceType
- the source text of the attributeXPathException
- if the syntax is invalid or for example if it refers to a type
that is not in the static contextprotected void processExtensionElementAttribute(String ns) throws XPathException
ns
- the namespace URI of the attribute - either the XSLT namespace or "" for the null namespaceXPathException
- if the value of the attribute is invalidprotected void processExcludedNamespaces(String ns) throws XPathException
ns
- the namespace URI of the attribute required, either the XSLT namespace or ""XPathException
- if the value of the attribute is invalidprotected void processVersionAttribute(String ns) throws XPathException
ns
- the namespace URI of the attribute required, either the XSLT namespace or ""XPathException
- if the value of the attribute is invalidpublic int getEffectiveVersion()
protected int validateValidationAttribute(String value) throws XPathException
value
- the raw value of the attributeXPathException
- if the attribute value is invalidpublic boolean forwardsCompatibleModeIsEnabled()
public boolean xPath10ModeIsEnabled()
public int getProcessorVersion()
public boolean isXslt30Processor()
protected void processDefaultCollationAttribute() throws XPathException
XPathException
- if the value is not a valid URI, or not a recognized collation URIprotected String getDefaultCollationName()
public StringCollator findCollation(String name, String baseURI) throws XPathException
name
- identifies the name of the collation requiredbaseURI
- the base URI to be used for resolving the collation name if it is relativeXPathException
- if either URI is invalid as a URIprotected void processDefaultMode() throws XPathException
XPathException
- if the value is not a valid EQName, or the token #unnamedpublic StructuredQName getDefaultMode() throws XPathException
XPathException
protected boolean definesExtensionElement(String uri)
uri
- the namespace URI being testedpublic boolean isExtensionNamespace(String uri)
uri
- the namespace URI being testedprotected boolean definesExcludedNamespace(String uri)
uri
- the namespace URI being testedpublic boolean isExcludedNamespace(String uri)
uri
- the namespace URI being testedprotected void processDefaultXPathNamespaceAttribute(String ns)
ns
- the namespace URI of the attribute required (the default namespace or the XSLT namespace.)protected String getDefaultXPathNamespace()
NamespaceConstant.NULL
for the non-namespaceprotected void processExpandTextAttribute(String ns) throws XPathException
ns
- the namespace URI of the attribute required (the default namespace or the XSLT namespace.)XPathException
- if the value of the attribute is invalidpublic boolean isExpandingText()
public SchemaType getSchemaType(String typeAtt) throws XPathException
typeAtt
- the value of the type attributeXPathException
- if the type is not declared in an
imported schema, or is not a built-in typepublic SimpleType getTypeAnnotation(SchemaType schemaType)
schemaType
- the schema typepublic void validate(ComponentDeclaration decl) throws XPathException
decl
- the declaration to be validatedXPathException
- if any error is found during validationpublic void postValidate() throws XPathException
XPathException
- if any error is found during post-traversal validationpublic void index(ComponentDeclaration decl, PrincipalStylesheetModule top) throws XPathException
decl
- the Declaration being indexed. (This corresponds to the StyleElement object
except in cases where one module is imported several times with different precedence.)top
- represents the outermost XSLStylesheet or XSLPackage elementXPathException
- if any error is encounteredpublic Expression typeCheck(String name, Expression exp) throws XPathException
name
- the name of the attribute containing the expression to be checked (used for diagnostics)exp
- the expression to be checkedXPathException
- if type-checking fails statically, that is, if it can be determined that the
supplied value for the expression cannot possibly be of the required typepublic void allocateLocalSlots(Expression exp)
exp
- the XPath expression for which slots are to be allocatedpublic Pattern typeCheck(String name, Pattern pattern) throws XPathException
name
- the name of the attribute holding the pattern, for example "match": used in
diagnosticspattern
- the compiled patternXPathException
- if the pattern fails optimistic static type-checkingpublic void fixupReferences() throws XPathException
XPathException
- if any references cannot be fixed up.public SlotManager getContainingSlotManager()
public void validateSubtree(ComponentDeclaration decl, boolean excludeStylesheet) throws XPathException
decl
- the declaration to be validatedexcludeStylesheet
- true if the XSLStylesheet element is to be excludedXPathException
- if validation failsprotected void validateChildren(ComponentDeclaration decl, boolean excludeStylesheet) throws XPathException
decl
- the declaration whose children are to be validatedexcludeStylesheet
- true if the xsl:stylesheet element is to be excludedXPathException
- if validation failsprotected boolean isPermittedChild(StyleElement child)
child
- the child that may or may not be permittedpublic PrincipalStylesheetModule getPrincipalStylesheetModule()
public StylesheetPackage getContainingPackage()
protected void checkSortComesFirst(boolean sortRequired) throws XPathException
sortRequired
- true if there must be at least one xsl:sort elementXPathException
- if invalidpublic void checkTopLevel(String errorCode, boolean allowOverride) throws XPathException
errorCode
- the error to throw if it is not at the top level; defaults to XTSE0010
if the value is nullallowOverride
- true if the element is allowed to appear as a child of xsl:overrideXPathException
- if not at top levelpublic void checkEmpty() throws XPathException
XPathException
- if it is not emptypublic void reportAbsence(String attribute) throws XPathException
attribute
- the name of the attribute whose absence is to be reportedXPathException
- if the attribute is missingpublic Expression compile(Compilation compilation, ComponentDeclaration decl) throws XPathException
compilation
- the compilation episodedecl
- the containing top-level declaration, for example xsl:function or xsl:templateXPathException
- if validation failsprotected String generateId()
public void compileDeclaration(Compilation compilation, ComponentDeclaration decl) throws XPathException
compilation
- the compilation episodedecl
- the containing top-level declaration, for example xsl:function or xsl:templateXPathException
- if compilation failspublic Expression compileSequenceConstructor(Compilation compilation, ComponentDeclaration decl, boolean includeParams) throws XPathException
compilation
- the Executabledecl
- the Declaration of the containing top-level stylesheet elementincludeParams
- true if xsl:param elements are to be treated as child instructions (true
for templates but not for functions)XPathException
- if compilation failspublic Expression compileSequenceConstructor(Compilation compilation, ComponentDeclaration decl, SequenceIterator iter, boolean includeParams) throws XPathException
compilation
- the Executabledecl
- the Declaration of the containing top-level stylesheet elementiter
- Iterator over the children. This is used in the case where there are children
that are not part of the sequence constructor, for example the xsl:sort children of xsl:for-each;
the iterator can be positioned past such elements.includeParams
- true if xsl:param elements are to be treated as child instructions (true
for templates but not for functions)XPathException
- if compilation failsprotected static Expression makeTraceInstruction(StyleElement source, Expression child)
source
- the parent elementchild
- the compiled expression tree for the instruction to be tracedprotected Expression fallbackProcessing(Compilation exec, ComponentDeclaration decl, StyleElement instruction) throws XPathException
exec
- the Executabledecl
- the Declaration of the top-level element containing the extension instructioninstruction
- The unknown extension instructionXPathException
- if any error occursprotected Location allocateLocation()
public SortKeyDefinitionList makeSortKeys(Compilation compilation, ComponentDeclaration decl) throws XPathException
compilation
- the compilation episodedecl
- the declaration containing the sort keys @throws XPathException if any error is detectedXPathException
- if an error is foundprotected StructuredQName[] getUsedAttributeSets(String use) throws XPathException
use
- the original value of the [xsl:]use-attribute-sets attributeXPathException
- if any error is detectedprotected Visibility interpretVisibilityValue(String s, String flags) throws XPathException
s
- the value of the attribute after whitespace collapsingflags
- contains "h" if the value "hidden" is allowed, "a" if the value "absent" is allowedXPathException
- if the value is invalidprotected WithParam[] getWithParamInstructions(Expression parent, Compilation compilation, ComponentDeclaration decl, boolean tunnel) throws XPathException
compilation
- the compilation episodedecl
- the containing stylesheet declarationtunnel
- true if the tunnel="yes" parameters are wanted, false to getXPathException
- if any error is detectedpublic void compileError(XPathException error) throws XPathException
error
- contains information about the errorXPathException
- always, after reporting the error to the ErrorListenerpublic void compileError(String message) throws XPathException
message
- the error messageXPathException
- always, after reporting the error to the ErrorListenerpublic void compileError(String message, StructuredQName errorCode) throws XPathException
message
- the error messageerrorCode
- the error code. May be null if not known or not definedXPathException
- always, after reporting the error to the ErrorListenerpublic void compileError(String message, String errorCode) throws XPathException
message
- the error messageerrorCode
- the error code. May be null if not known or not definedXPathException
- always, after reporting the error to the ErrorListenerpublic void compileErrorInAttribute(String message, String errorCode, String attributeName) throws XPathException
message
- the error messageerrorCode
- the error code. May be null if not known or not definedattributeName
- the name of the attribute. For attributes in no namespace
this is the local part of the name; for namespaced attributes
a name in Clark format may be supplied.XPathException
- always, after reporting the error to the ErrorListenerprotected void invalidAttribute(String attributeName, String allowedValues) throws XPathException
XPathException
protected void undeclaredNamespaceError(String prefix, String errorCode, String attributeName) throws XPathException
XPathException
public void compileWarning(String message, StructuredQName errorCode) throws XPathException
XPathException
public void compileWarning(String message, String errorCode) throws XPathException
XPathException
protected void issueWarning(XPathException error)
error
- an exception containing the warning textprotected void issueWarning(String message, SourceLocator locator)
message
- the warning message textlocator
- the location of the problem in the source stylesheetpublic boolean isTopLevel()
public SourceBinding getBindingInformation(StructuredQName name)
name
- the variable namepublic SourceBinding bindVariable(StructuredQName qName)
qName
- The name of the variablepublic SourceBinding bindLocalVariable(StructuredQName qName)
qName
- The name of the variableprotected boolean seesAvuncularVariables()
protected SourceBinding hasImplicitBinding(StructuredQName name)
public int getConstructType()
LocationKind
. This method is part of the InstructionInfo
interfacepublic StructuredQName getObjectName()
public void setObjectName(StructuredQName qName)
qName
- the object name as a QNamepublic Object getProperty(String name)
InstructionInfo
interface for run-time tracing and debugging. The properties
available include all the attributes of the source instruction (named by the attribute name):
these are all provided as string values.name
- The name of the required propertypublic Iterator<String> getProperties()
public int getHostLanguage()
Configuration.XSLT
or Configuration.XQUERY
public boolean isActionCompleted(int action)
action
- for example ACTION_VALIDATEpublic void setActionCompleted(int action)
action
- for example ACTION_VALIDATEprotected final long getSequenceNumber()
getSequenceNumber
in class NodeImpl
protected final int getRawSequenceNumber()
protected final void setRawSequenceNumber(int seq)
protected final void setChildren(Object children)
children
- null if there are no children, a single NodeInfo if there is one child, an array of NodeInfo
if there are multiple childrenpublic final boolean hasChildNodes()
hasChildNodes
in interface NodeInfo
hasChildNodes
in class NodeImpl
true
if the node has any children,
false
if the node has no children.public final int getNumberOfChildren()
protected final AxisIterator iterateChildren(NodeTest test)
test
- A NodeTest to be satisfied by the child nodes, or null
if all child node are to be returnedpublic final NodeImpl getFirstChild()
getFirstChild
in interface SteppingNode<NodeImpl>
getFirstChild
in class NodeImpl
public final NodeImpl getLastChild()
getLastChild
in class NodeImpl
protected final NodeImpl getNthChild(int n)
n
- identifies the required childprotected void removeChild(NodeImpl child)
child
- the child to be removedpublic String getStringValue()
Item.getStringValueCS()
public CharSequence getStringValueCS()
NodeImpl
getStringValueCS
in interface Item
getStringValueCS
in class NodeImpl
Item.getStringValue()
protected void addChild(NodeImpl node, int index)
node
- the node to be added as a child of this node. This must be an instance of
NodeImpl
. It will be modified as a result of this call (by setting its
parent property and sibling position)index
- the position where the child is to be addedpublic void insertChildren(NodeInfo[] source, boolean atStart, boolean inherit)
This method takes no action unless the target node is a document node or element node. It also takes no action in respect of any supplied nodes that are not elements, text nodes, comments, or processing instructions.
The supplied nodes will form the new children. Adjacent text nodes will be merged, and zero-length text nodes removed. The supplied nodes may be modified in situ, for example to change their parent property and to add namespace bindings, or they may be copied, at the discretion of the implementation.
insertChildren
in interface MutableNodeInfo
insertChildren
in class NodeImpl
source
- the nodes to be inserted. The implementation determines what implementation classes
of node it will accept; this implementation will accept text, comment, and processing instruction
nodes belonging to any implementation, but elements must be instances of ElementImpl
.
The supplied nodes will be modified in situ, for example
to change their parent property and to add namespace bindings, if they are instances of
ElementImpl
; otherwise they will be copied. If the nodes are copied, then on return
the supplied source array will contain the copy rather than the original.atStart
- true if the new nodes are to be inserted before existing children; false if they are
to be inserted after existing childreninherit
- true if the inserted nodes are to inherit the namespaces of their new parent; false
if such namespaces are to be undeclaredIllegalArgumentException
- if the supplied nodes use a node implementation that this
implementation does not accept.protected void insertChildrenAt(NodeInfo[] source, int index, boolean inherit)
source
- the children to be inserted. We allow any kind of text, comment, or processing instruction
node, but element nodes must be instances of this NodeInfo implementation.index
- the position before which they are to be inserted: 0 indicates insertion before the
first child, 1 insertion before the second child, and so on.inherit
- true if the inserted nodes are to inherit the namespaces that are in-scope for their
new parent; false if such namespaces should be undeclared on the childrenprotected void replaceChildrenAt(NodeInfo[] source, int index, boolean inherit)
source
- the children to be insertedindex
- the position at which they are to be inserted: 0 indicates replacement of the
first child, replacement of the second child, and so on. The effect is undefined if index
is out of rangeinherit
- set to true if the new child elements are to inherit the in-scope namespaces
of their new parentIllegalArgumentException
- if any of the replacement nodes is not an element, text,
comment, or processing instruction nodepublic void compact(int size)
size
- the number of actual childrenCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.