net.sf.saxon.style
Class StyleElement

java.lang.Object
  extended by net.sf.saxon.tree.linked.NodeImpl
      extended by net.sf.saxon.tree.linked.ElementImpl
          extended by net.sf.saxon.style.StyleElement
All Implemented Interfaces:
Serializable, Source, SourceLocator, LocationProvider, SaxonLocator, PullEvent, Container, FingerprintedNode, Item<NodeInfo>, MutableNodeInfo, NamespaceResolver, NodeInfo, ValueRepresentation<NodeInfo>, InstructionInfo, SiblingCountingNode, Locator
Direct Known Subclasses:
AbsentExtensionElement, ExtensionInstruction, LiteralResultElement, SaxonCollation, SaxonDoctype, SaxonEntityRef, SaxonImportQuery, SaxonWhile, SQLColumn, XSLAnalyzeString, XSLApplyImports, XSLApplyTemplates, XSLAttributeSet, XSLBreakOrContinue, XSLCallTemplate, XSLCatch, XSLCharacterMap, XSLChoose, XSLCopy, XSLCopyOf, XSLDecimalFormat, XSLDocument, XSLElement, XSLEvaluate, XSLFallback, XSLForEach, XSLForEachGroup, XSLFork, XSLFunction, XSLGeneralIncorporate, XSLGeneralVariable, XSLIf, XSLImportSchema, XSLIterate, XSLKey, XSLLeafNodeConstructor, XSLMatchingSubstring, XSLMerge, XSLMergeAction, XSLMergeInput, XSLMergeSource, XSLMessage, XSLMode, XSLNamespaceAlias, XSLNextMatch, XSLNumber, XSLOnCompletion, XSLOtherwise, XSLOutput, XSLOutputCharacter, XSLPerformSort, XSLPreserveSpace, XSLResultDocument, XSLSequence, XSLSortOrMergeKey, XSLStylesheet, XSLTemplate, XSLTry, XSLWhen

public abstract class StyleElement
extends ElementImpl
implements Locator, Container, InstructionInfo

Abstract superclass for all element nodes in the stylesheet.

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.

See Also:
Serialized Form

Field Summary
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  String defaultXPathNamespace
           
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  DecimalValue version
           
protected static String[] YES_NO
           
 
Fields inherited from class net.sf.saxon.tree.linked.NodeImpl
NODE_LETTER
 
Fields inherited from interface net.sf.saxon.om.NodeInfo
ALL_NAMESPACES, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES
 
Constructor Summary
StyleElement()
          Constructor
 
Method Summary
protected  void addChild(NodeImpl node, int index)
          Add a child node to this node.
protected  int allocateLocationId(String systemId, int lineNumber)
          Allocate a location identifier
 void allocatePatternSlots(int slots)
          Allocate space for range variables within predicates in the match pattern.
 void allocateSlots(Expression exp)
          Allocate slots in the local stack frame to range variables used in an XPath expression
 XSLVariableDeclaration 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
 XSLVariableDeclaration bindVariable(StructuredQName qName)
          Bind a variable used in this element to the compiled form of the XSLVariable element in which it is declared
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)
          Convenience method to check that the stylesheet element is at the top level
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(Executable exec, Declaration decl)
          Compile the instruction on the stylesheet tree into an executable instruction for use at run-time.
 void compileDeclaration(Executable exec, Declaration decl)
          Compile a declaration in the stylesheet tree for use at run-time.
protected  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
protected  void compileError(XPathException error)
          Report an error with diagnostic information
 Expression compileSequenceConstructor(Executable exec, Declaration 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.
protected  void compileWarning(String message, String errorCode)
           
protected  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  AxisIterator enumerateChildren(NodeTest test)
          Get an enumeration of the children of this node
protected  Expression fallbackProcessing(Executable exec, Declaration decl, StyleElement instruction)
          Perform fallback processing.
 void fixupReferences()
          Fix up references from XPath expressions.
 boolean forwardsCompatibleModeIsEnabled()
          Determine whether forwards-compatible mode is enabled for this element
protected  AttributeSet[] getAttributeSets(String use, List<Declaration> list)
          Get the list of attribute-sets associated with this element.
 String getAttributeValue(String clarkName)
          Get an attribute value given the Clark name of the attribute (that is, the name in {uri}local format).
 int getColumnNumber(long locationId)
          Get the column number within the document, entity, or module containing a particular location
protected  ItemType getCommonChildItemType()
          Get the most general type of item returned by the children of this instruction
 int getConstructType()
          Get the type of construct.
 int getContainerGranularity()
          Get the granularity of the container.
 SlotManager getContainingSlotManager()
          Get the SlotManager for the containing Procedure definition
 XSLStylesheet getContainingStylesheet()
          Get the containing XSLStylesheet element
protected  String getDefaultCollationName()
          Get the default collation for this stylesheet element.
protected  String getDefaultXPathNamespace()
          Get the default XPath namespace for elements and types
 DecimalValue getEffectiveVersion()
          Get the numeric value of the version number appearing as an attribute on this element, or inherited from its ancestors
 Executable getExecutable()
          Get the Executable (representing a complete stylesheet or query) of which this Container forms part
 NodeInfo 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
 NodeInfo getLastChild()
          Get the last child node of the element
protected  StyleElement getLastChildInstruction()
          Find the last child instruction of this instruction.
 int getLineNumber(long locationId)
          Get the line number within the document, entity or module containing a particular location
 LocationProvider getLocationProvider()
          Get the LocationProvider allowing location identifiers to be resolved.
 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.
 PreparedStylesheet getPreparedStylesheet()
          Get the PreparedStylesheet object.
 PrincipalStylesheetModule getPrincipalStylesheetModule()
          Get the principal stylesheet module
 DecimalValue 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()
           
protected  ItemType getReturnedItemType()
          Determine the type of item returned by this instruction (only relevant if it is an instruction).
 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).
 StaticContext getStaticContext()
          Get the static context for expressions on this element
 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.
 String getSystemId(long locationId)
          Get the URI of the document, entity, or module containing a particular location
 SimpleType getTypeAnnotation(SchemaType schemaType)
          Get the type annotation to use for a given schema type
protected  WithParam[] getWithParamInstructions(Executable exec, Declaration decl, boolean tunnel, Expression caller)
          Get the list of xsl:with-param elements for a calling element (apply-templates, call-template, apply-imports, next-match).
 boolean hasChildNodes()
          Determine if the node has any children.
protected  void index(Declaration 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
 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.
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.
protected  void issueWarning(String message, SourceLocator locator)
          Report a warning to the error listener
protected  void issueWarning(TransformerException 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  Expression makeAttributeValueTemplate(String expression)
          Make an attribute value template in the context of this stylesheet element
 Expression makeExpression(String expression)
          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)
          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, and registering the code in the namepool.
 SequenceType makeSequenceType(String sequenceType)
          Process an attribute whose value is a SequenceType
 SortKeyDefinition[] makeSortKeys(Declaration 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.
protected  void processAllAttributes()
          Process the attributes of this element and all its children
protected  void processAttributes()
          Process the attribute list for the element.
protected  void processDefaultCollationAttribute()
          Process the [xsl:]default-xpath-namespace 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 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 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)
           
 void validate(Declaration decl)
          Check that the stylesheet element is valid.
protected  void validateChildren(Declaration decl)
          Validate the children of this node, recursively.
 void validateSubtree(Declaration decl)
          Recursive walk through the stylesheet to validate all nodes
 boolean xPath10ModeIsEnabled()
          Determine whether 1.0-compatible mode is enabled for this element
 
Methods inherited from class net.sf.saxon.tree.linked.ElementImpl
addAttribute, addNamespace, copy, delete, fixupInsertedNamespaces, generateId, getAttributeList, getAttributeValue, getAttributeValue, getBaseURI, getColumnNumber, getDeclaredNamespaces, getDocumentRoot, getLineNumber, getNameCode, getNamespaceList, getNodeKind, getPrefixForURI, getRoot, getSchemaType, getSystemId, getTypeAnnotation, getURIForPrefix, gsetAttributeCollection, initialise, isId, isNilled, iteratePrefixes, removeAttribute, removeTypeAnnotation, rename, replaceStringValue, setAttributeList, setLocation, setNameCode, setNamespaceDeclarations, setNamespaceList, setSystemId, setTypeAnnotation
 
Methods inherited from class net.sf.saxon.tree.linked.NodeImpl
atomize, compareOrder, equals, getConfiguration, getDisplayName, getDocumentNumber, getFingerprint, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPhysicalRoot, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getRawParent, getSiblingPosition, getTypedValue, getURI, insertSiblings, isDeleted, isIdref, isSameNodeInfo, iterateAxis, iterateAxis, newBuilder, replace, setRawParent, setSiblingPosition
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.saxon.trace.InstructionInfo
getLineNumber, getSystemId
 
Methods inherited from interface org.xml.sax.Locator
getColumnNumber, getPublicId
 
Methods inherited from interface javax.xml.transform.SourceLocator
getColumnNumber, getPublicId
 
Methods inherited from interface net.sf.saxon.om.NodeInfo
hashCode
 

Field Detail

extensionNamespaces

protected String[] extensionNamespaces

version

protected DecimalValue version

staticContext

protected ExpressionContext staticContext

validationError

protected XPathException validationError

reportingCircumstances

protected int reportingCircumstances

defaultXPathNamespace

protected String defaultXPathNamespace

defaultCollationName

protected String defaultCollationName

REPORT_ALWAYS

public static final int REPORT_ALWAYS
See Also:
Constant Field Values

REPORT_UNLESS_FORWARDS_COMPATIBLE

public static final int REPORT_UNLESS_FORWARDS_COMPATIBLE
See Also:
Constant Field Values

REPORT_IF_INSTANTIATED

public static final int REPORT_IF_INSTANTIATED
See Also:
Constant Field Values

REPORT_UNLESS_FALLBACK_AVAILABLE

public static final int REPORT_UNLESS_FALLBACK_AVAILABLE
See Also:
Constant Field Values

actionsCompleted

protected int actionsCompleted

ACTION_VALIDATE

public static final int ACTION_VALIDATE
See Also:
Constant Field Values

ACTION_COMPILE

public static final int ACTION_COMPILE
See Also:
Constant Field Values

ACTION_TYPECHECK

public static final int ACTION_TYPECHECK
See Also:
Constant Field Values

ACTION_OPTIMIZE

public static final int ACTION_OPTIMIZE
See Also:
Constant Field Values

ACTION_FIXUP

public static final int ACTION_FIXUP
See Also:
Constant Field Values

ACTION_PROCESS_ATTRIBUTES

public static final int ACTION_PROCESS_ATTRIBUTES
See Also:
Constant Field Values

YES_NO

protected static final String[] YES_NO
Constructor Detail

StyleElement

public StyleElement()
Constructor

Method Detail

getExecutable

public Executable getExecutable()
Description copied from interface: Container
Get the Executable (representing a complete stylesheet or query) of which this Container forms part

Specified by:
getExecutable in interface Container
Returns:
the executable

getLocationProvider

public LocationProvider getLocationProvider()
Get the LocationProvider allowing location identifiers to be resolved.

Specified by:
getLocationProvider in interface Container
Returns:
the location provider

getStaticContext

public StaticContext getStaticContext()
Get the static context for expressions on this element

Returns:
the static context

getContainerGranularity

public int getContainerGranularity()
Get the granularity of the container.

Specified by:
getContainerGranularity in interface Container
Returns:
0 for a temporary container created during parsing; 1 for a container that operates at the level of an XPath expression; 2 for a container at the level of a global function or template

makeExpressionVisitor

public ExpressionVisitor makeExpressionVisitor()
Make an expression visitor

Returns:
the expression visitor

isExplaining

protected boolean isExplaining()
Determine whether saxon:explain has been set to "yes"

Returns:
true if saxon:explain has been set to "yes" on this element

substituteFor

public void substituteFor(StyleElement temp)
Make this node a substitute for a temporary one previously added to the tree. See StyleNodeFactory for details. "A node like the other one in all things but its class". Note that at this stage, the node will not yet be known to its parent, though it will contain a reference to its parent; and it will have no children.

Parameters:
temp - the element which this one is substituting for

setValidationError

public void setValidationError(TransformerException reason,
                               int circumstances)
Set a validation error. This is an error detected during construction of this element on the stylesheet, but which is not to be reported until later.

Parameters:
reason - the details of the error
circumstances - a code identifying the circumstances under which the error is to be reported

isInstruction

public boolean isInstruction()
Ask whether this node is an instruction. The default implementation says it isn't.

Returns:
true if this element is an instruction

isDeclaration

public boolean isDeclaration()
Ask whether this node is a declaration, that is, a permitted child of xsl:stylesheet (including xsl:include and xsl:import). The default implementation returns false

Returns:
true if the element is a permitted child of xsl:stylesheet or xsl:transform

getReturnedItemType

protected ItemType getReturnedItemType()
Determine the type of item returned by this instruction (only relevant if it is an instruction). Default implementation returns Type.ITEM, indicating that we don't know, it might be anything. Returns null in the case of an element such as xsl:sort or xsl:variable that can appear in a sequence constructor but contributes nothing to the result sequence.

Returns:
the item type returned

getCommonChildItemType

protected ItemType getCommonChildItemType()
Get the most general type of item returned by the children of this instruction

Returns:
the lowest common supertype of the item types returned by the children

markTailCalls

protected boolean markTailCalls()
Mark tail-recursive calls on templates and functions. For most instructions, this returns false.

Returns:
true if one or more tail calls were identified

mayContainSequenceConstructor

protected boolean mayContainSequenceConstructor()
Determine whether this type of element is allowed to contain a sequence constructor

Returns:
true if this instruction is allowed to contain a sequence constructor

mayContainFallback

protected boolean mayContainFallback()
Determine whether this type of element is allowed to contain an xsl:fallback instruction. Note that this is only relevant if the element is an instruction.

Returns:
true if this element is allowed to contain an xsl:fallback

mayContainParam

protected boolean mayContainParam(String attName)
Determine whether this type of element is allowed to contain an xsl:param element

Parameters:
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 allowed
Returns:
true if this element is allowed to contain an xsl:param

getContainingStylesheet

public XSLStylesheet getContainingStylesheet()
Get the containing XSLStylesheet element

Returns:
the XSLStylesheet element representing the outermost element of the containing stylesheet module. Exceptionally, return null if there is no containing XSLStylesheet element

makeQName

public final StructuredQName makeQName(String lexicalQName)
                                throws XPathException,
                                       NamespaceException
Make a structured QName, using this Element as the context for namespace resolution, and registering the code in the namepool. If the name is unprefixed, the default namespace is not used.

Parameters:
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
Returns:
the StructuredQName representation of this lexical QName
Throws:
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 declared

makeNamespaceContext

public SavedNamespaceContext makeNamespaceContext()
Make a NamespaceContext object representing the list of in-scope namespaces. This will be a copy of the namespace context with no references to objects in the stylesheet tree, so that it can be kept until run-time without locking the tree down in memory.

Returns:
a copy of the namespace context

getNamespaceResolver

public NamespaceResolver getNamespaceResolver()
Get the namespace context of the instruction.

Returns:
the namespace context. This method does not make a copy of the namespace context, so a reference to the returned NamespaceResolver will lock the stylesheet tree in memory.

processAllAttributes

protected void processAllAttributes()
                             throws XPathException
Process the attributes of this element and all its children

Throws:
XPathException - in the event of a static error being detected

processStandardAttributes

public void processStandardAttributes(String namespace)
                               throws XPathException
Process the standard attributes such as [xsl:]default-collation

Parameters:
namespace - either "" to find the attributes in the null namespace, or NamespaceConstant.XSLT to find them in the XSLT namespace
Throws:
XPathException - if any of the standard attributes is incorrect

getAttributeValue

public String getAttributeValue(String clarkName)
Get an attribute value given the Clark name of the attribute (that is, the name in {uri}local format).

Parameters:
clarkName - the name of the attribute in {uri}local format
Returns:
the value of the attribute if it exists, or null otherwise

processAttributes

protected final void processAttributes()
                                throws XPathException
Process the attribute list for the element. This is a wrapper method that calls prepareAttributes (provided in the subclass) and traps any exceptions

Throws:
XPathException - if a static error is detected

checkUnknownAttribute

protected void checkUnknownAttribute(NodeName nc)
                              throws XPathException
Check whether an unknown attribute is permitted.

Parameters:
nc - The name code of the attribute name
Throws:
XPathException - (and reports the error) if this is an attribute that is not permitted on the containing element

prepareAttributes

protected abstract void prepareAttributes()
                                   throws XPathException
Set the attribute list for the element. This is called to process the attributes (note the distinction from processAttributes in the superclass). Must be supplied in a subclass

Throws:
XPathException - if a static error is detected

getLastChildInstruction

protected StyleElement getLastChildInstruction()
Find the last child instruction of this instruction. Returns null if there are no child instructions, or if the last child is a text node.

Returns:
the last child instruction, or null if there are no child instructions

makeExpression

public Expression makeExpression(String expression)
                          throws XPathException
Compile an XPath expression in the context of this stylesheet element

Parameters:
expression - the source text of the XPath expression
Returns:
the compiled expression tree for the XPath expression
Throws:
XPathException - if a static error is detected in the XPath expression

makePattern

public Pattern makePattern(String pattern)
                    throws XPathException
Make a pattern in the context of this stylesheet element

Parameters:
pattern - the source text of the pattern
Returns:
the compiled pattern
Throws:
XPathException - if a static error is detected in the pattern

makeAttributeValueTemplate

protected Expression makeAttributeValueTemplate(String expression)
                                         throws XPathException
Make an attribute value template in the context of this stylesheet element

Parameters:
expression - the source text of the attribute value template
Returns:
a compiled XPath expression that computes the value of the attribute (including concatenating the results of embedded expressions with any surrounding fixed text)
Throws:
XPathException - if a static error is detected in the AVT

checkAttributeValue

protected void checkAttributeValue(String name,
                                   String value,
                                   boolean avt,
                                   String[] allowed)
                            throws XPathException
Check the value of an attribute, as supplied statically

Parameters:
name - the name of the attribute
value - the value of the attribute
avt - set to true if the value is permitted to be an attribute value template
allowed - list of permitted values, which must be in alphabetical order
Throws:
XPathException - if the value given for the attribute is not a permitted value

makeSequenceType

public SequenceType makeSequenceType(String sequenceType)
                              throws XPathException
Process an attribute whose value is a SequenceType

Parameters:
sequenceType - the source text of the attribute
Returns:
the processed sequence type
Throws:
XPathException - if the syntax is invalid or for example if it refers to a type that is not in the static context

processExtensionElementAttribute

protected void processExtensionElementAttribute(String ns)
                                         throws XPathException
Process the [xsl:]extension-element-prefixes attribute if there is one

Parameters:
ns - the namespace URI of the attribute - either the XSLT namespace or "" for the null namespace
Throws:
XPathException - if the value of the attribute is invalid

processExcludedNamespaces

protected void processExcludedNamespaces(String ns)
                                  throws XPathException
Process the [xsl:]exclude-result-prefixes attribute if there is one

Parameters:
ns - the namespace URI of the attribute required, either the XSLT namespace or ""
Throws:
XPathException - if the value of the attribute is invalid

processVersionAttribute

protected void processVersionAttribute(String ns)
                                throws XPathException
Process the [xsl:]version attribute if there is one

Parameters:
ns - the namespace URI of the attribute required, either the XSLT namespace or ""
Throws:
XPathException - if the value of the attribute is invalid

getEffectiveVersion

public DecimalValue getEffectiveVersion()
Get the numeric value of the version number appearing as an attribute on this element, or inherited from its ancestors

Returns:
the version number as a decimal

forwardsCompatibleModeIsEnabled

public boolean forwardsCompatibleModeIsEnabled()
Determine whether forwards-compatible mode is enabled for this element

Returns:
true if forwards-compatible mode is enabled

xPath10ModeIsEnabled

public boolean xPath10ModeIsEnabled()
Determine whether 1.0-compatible mode is enabled for this element

Returns:
true if 1.0 compatable mode is enabled, that is, if this or an enclosing element specifies an [xsl:]version attribute whose value is less than 2.0

getProcessorVersion

public DecimalValue getProcessorVersion()
Determine what version of the XSLT the configured processor supports

Returns:
the version of XSLT supported by the processor

isXslt30Processor

public boolean isXslt30Processor()
Ask whether the configured XSLT processor supports XSLT 3.0

Returns:
true if the configured XSLT processor supports XSLT 3.0

processDefaultCollationAttribute

protected void processDefaultCollationAttribute()
                                         throws XPathException
Process the [xsl:]default-xpath-namespace attribute if there is one

Throws:
XPathException - if the value is not a valid URI, or not a recognized collation URI

getDefaultCollationName

protected String getDefaultCollationName()
Get the default collation for this stylesheet element. If no default collation is specified in the stylesheet, return the Unicode codepoint collation name.

Returns:
the name of the default collation

definesExtensionElement

protected boolean definesExtensionElement(String uri)
Check whether a particular extension element namespace is defined on this node. This checks this node only, not the ancestor nodes. The implementation checks whether the prefix is included in the [xsl:]extension-element-prefixes attribute.

Parameters:
uri - the namespace URI being tested
Returns:
true if this namespace is defined on this element as an extension element namespace

isExtensionNamespace

public boolean isExtensionNamespace(String uri)
Check whether a namespace uri defines an extension element. This checks whether the namespace is defined as an extension namespace on this or any ancestor node.

Parameters:
uri - the namespace URI being tested
Returns:
true if the URI is an extension element namespace URI

definesExcludedNamespace

protected boolean definesExcludedNamespace(String uri)
Check whether this node excludes a particular namespace from the result. This method checks this node only, not the ancestor nodes.

Parameters:
uri - the namespace URI being tested
Returns:
true if the namespace is excluded by virtue of an [xsl:]exclude-result-prefixes attribute

isExcludedNamespace

public boolean isExcludedNamespace(String uri)
Check whether a namespace uri defines an namespace excluded from the result. This checks whether the namespace is defined as an excluded namespace on this or any ancestor node.

Parameters:
uri - the namespace URI being tested
Returns:
true if this namespace URI is a namespace excluded by virtue of exclude-result-prefixes on this element or on an ancestor element

processDefaultXPathNamespaceAttribute

protected void processDefaultXPathNamespaceAttribute(String ns)
Process the [xsl:]xpath-default-namespace attribute if there is one

Parameters:
ns - the namespace URI of the attribute required (the default namespace or the XSLT namespace.)

getDefaultXPathNamespace

protected String getDefaultXPathNamespace()
Get the default XPath namespace for elements and types

Returns:
the default namespace for elements and types. Return NamespaceConstant.NULL for the non-namespace

getSchemaType

public SchemaType getSchemaType(String typeAtt)
                         throws XPathException
Get the Schema type definition for a type named in the stylesheet (in a "type" attribute).

Parameters:
typeAtt - the value of the type attribute
Returns:
the corresponding schema type
Throws:
XPathException - if the type is not declared in an imported schema, or is not a built-in type

getTypeAnnotation

public SimpleType getTypeAnnotation(SchemaType schemaType)
Get the type annotation to use for a given schema type

Parameters:
schemaType - the schema type
Returns:
the corresponding numeric type annotation

validate

public void validate(Declaration decl)
              throws XPathException
Check that the stylesheet element is valid. This is called once for each element, after the entire tree has been built. As well as validation, it can perform first-time initialisation. The default implementation does nothing; it is normally overriden in subclasses.

Parameters:
decl - the declaration to be validated
Throws:
XPathException - if any error is found during validation

postValidate

public void postValidate()
                  throws XPathException
Hook to allow additional validation of a parent element immediately after its children have been validated.

Throws:
XPathException - if any error is found during post-traversal validation

index

protected void index(Declaration decl,
                     PrincipalStylesheetModule top)
              throws XPathException
Method supplied by declaration elements to add themselves to a stylesheet-level index

Parameters:
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 - the outermost XSLStylesheet element
Throws:
XPathException - if any error is encountered

typeCheck

public Expression typeCheck(String name,
                            Expression exp)
                     throws XPathException
Type-check an expression. This is called to check each expression while the containing instruction is being validated. It is not just a static type-check, it also adds code to perform any necessary run-time type checking and/or conversion.

Parameters:
name - the name of the attribute containing the expression to be checked (used for diagnostics)
exp - the expression to be checked
Returns:
the (possibly rewritten) expression after type checking
Throws:
XPathException - 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 type

allocateSlots

public void allocateSlots(Expression exp)
Allocate slots in the local stack frame to range variables used in an XPath expression

Parameters:
exp - the XPath expression for which slots are to be allocated

allocatePatternSlots

public void allocatePatternSlots(int slots)
Allocate space for range variables within predicates in the match pattern. The xsl:template element has no XPath expressions among its attributes, so if this method is called on this object it can only be because there are variables used in the match pattern. We work out how many slots are needed for the match pattern in each template rule, and then apply-templates can allocate a stack frame that is large enough for the most demanding match pattern in the entire stylesheet.

Parameters:
slots - the number of slots required

typeCheck

public Pattern typeCheck(String name,
                         Pattern pattern)
                  throws XPathException
Type-check a pattern. This is called to check each pattern while the containing instruction is being validated. It is not just a static type-check, it also adds code to perform any necessary run-time type checking and/or conversion.

Parameters:
name - the name of the attribute holding the pattern, for example "match": used in diagnostics
pattern - the compiled pattern
Returns:
the original pattern, or a substitute pattern if it has been rewritten. Returns null if and only if the supplied pattern is null.
Throws:
XPathException - if the pattern fails optimistic static type-checking

fixupReferences

public void fixupReferences()
                     throws XPathException
Fix up references from XPath expressions. Overridden for function declarations and variable declarations

Throws:
XPathException - if any references cannot be fixed up.

getContainingSlotManager

public SlotManager getContainingSlotManager()
Get the SlotManager for the containing Procedure definition

Returns:
the SlotManager associated with the containing Function, Template, etc, or null if there is no such containing Function, Template etc.

validateSubtree

public void validateSubtree(Declaration decl)
                     throws XPathException
Recursive walk through the stylesheet to validate all nodes

Parameters:
decl - the declaration to be validated
Throws:
XPathException - if validation fails

validateChildren

protected void validateChildren(Declaration decl)
                         throws XPathException
Validate the children of this node, recursively. Overridden for top-level data elements.

Parameters:
decl - the declaration whose children are to be validated
Throws:
XPathException - if validation fails

isPermittedChild

protected boolean isPermittedChild(StyleElement child)
Check whether a given child is permitted for this element. This method is used when a non-instruction child element such as xsl:sort is encountered in a context where instructions would normally be expected.

Parameters:
child - the child that may or may not be permitted
Returns:
true if the child is permitted.

getPreparedStylesheet

public PreparedStylesheet getPreparedStylesheet()
Get the PreparedStylesheet object.

Returns:
the PreparedStylesheet to which this stylesheet element belongs. Exceptionally (with early errors in a simplified stylesheet module) return null.

getPrincipalStylesheetModule

public PrincipalStylesheetModule getPrincipalStylesheetModule()
Get the principal stylesheet module

Returns:
the principal stylesheet module

checkSortComesFirst

protected void checkSortComesFirst(boolean sortRequired)
                            throws XPathException
Check that among the children of this element, any xsl:sort elements precede any other elements

Parameters:
sortRequired - true if there must be at least one xsl:sort element
Throws:
XPathException - if invalid

checkTopLevel

public void checkTopLevel(String errorCode)
                   throws XPathException
Convenience method to check that the stylesheet element is at the top level

Parameters:
errorCode - the error to throw if it is not at the top level; defaults to XTSE0010 if the value is null
Throws:
XPathException - if not at top level

checkEmpty

public void checkEmpty()
                throws XPathException
Convenience method to check that the stylesheet element is empty

Throws:
XPathException - if it is not empty

reportAbsence

public void reportAbsence(String attribute)
                   throws XPathException
Convenience method to report the absence of a mandatory attribute

Parameters:
attribute - the name of the attribute whose absence is to be reported
Throws:
XPathException - if the attribute is missing

compile

public Expression compile(Executable exec,
                          Declaration decl)
                   throws XPathException
Compile the instruction on the stylesheet tree into an executable instruction for use at run-time.

Parameters:
exec - the Executable
decl - the containing top-level declaration, for example xsl:function or xsl:template
Returns:
either a ComputedExpression, or null. The value null is returned when compiling an instruction that returns a no-op, or when compiling a top-level object such as an xsl:template that compiles into something other than an instruction.
Throws:
XPathException - if validation fails

compileDeclaration

public void compileDeclaration(Executable exec,
                               Declaration decl)
                        throws XPathException
Compile a declaration in the stylesheet tree for use at run-time.

Parameters:
exec - the Executable
decl - the containing top-level declaration, for example xsl:function or xsl:template
Throws:
XPathException - if compilation fails

compileSequenceConstructor

public Expression compileSequenceConstructor(Executable exec,
                                             Declaration decl,
                                             SequenceIterator iter,
                                             boolean includeParams)
                                      throws XPathException
Compile the children of this instruction on the stylesheet tree, adding the subordinate instructions to the parent instruction on the execution tree.

Parameters:
exec - the Executable
decl - the Declaration of the containing top-level stylesheet element
iter - 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) @return an Expression tree representing the children of this instruction
Returns:
if compilation detects any static errors
Throws:
XPathException - if compilation fails

makeTraceInstruction

protected static Expression makeTraceInstruction(StyleElement source,
                                                 Expression child)
Create a trace instruction to wrap a real instruction

Parameters:
source - the parent element
child - the compiled expression tree for the instruction to be traced
Returns:
a wrapper instruction that performs the tracing (if activated at run-time)

fallbackProcessing

protected Expression fallbackProcessing(Executable exec,
                                        Declaration decl,
                                        StyleElement instruction)
                                 throws XPathException
Perform fallback processing. Generate fallback code for an extension instruction that is not recognized by the implementation.

Parameters:
exec - the Executable
decl - the Declaration of the top-level element containing the extension instruction
instruction - The unknown extension instruction
Returns:
the expression tree representing the fallback code
Throws:
XPathException - if any error occurs

allocateLocationId

protected int allocateLocationId(String systemId,
                                 int lineNumber)
Allocate a location identifier

Parameters:
systemId - identifies the module containing the instruction
lineNumber - the line number of the instruction
Returns:
an integer location ID which can be used to report the location of the instruction, by reference to a LocationProvider

makeSortKeys

public SortKeyDefinition[] makeSortKeys(Declaration decl)
                                 throws XPathException
Construct sort keys for a SortedIterator

Parameters:
decl - the declaration containing the sort keys
Returns:
an array of SortKeyDefinition objects if there are any sort keys; or null if there are none.
Throws:
XPathException - if any error is detected

getAttributeSets

protected AttributeSet[] getAttributeSets(String use,
                                          List<Declaration> list)
                                   throws XPathException
Get the list of attribute-sets associated with this element. This is used for xsl:element, xsl:copy, xsl:attribute-set, and on literal result elements

Parameters:
use - the original value of the [xsl:]use-attribute-sets attribute
list - an empty list to hold the list of XSLAttributeSet elements in the stylesheet tree. Or null, if these are not required.
Returns:
an array of AttributeList instructions representing the compiled attribute sets
Throws:
XPathException - if any error is detected

getWithParamInstructions

protected WithParam[] getWithParamInstructions(Executable exec,
                                               Declaration decl,
                                               boolean tunnel,
                                               Expression caller)
                                        throws XPathException
Get the list of xsl:with-param elements for a calling element (apply-templates, call-template, apply-imports, next-match). This method can be used to get either the tunnel parameters, or the non-tunnel parameters.

Parameters:
exec - the Executable
decl - the containing stylesheet declaration
tunnel - true if the tunnel="yes" parameters are wanted, false to get
caller - the calling instruction (for example xsl:apply-templates), used only for its location information @return an array of WithParam objects for either the ordinary parameters or the tunnel parameters
Returns:
an array containing the results of compiling the xsl:with-param children of this instruction (if any)
Throws:
XPathException - if any error is detected

compileError

protected void compileError(XPathException error)
                     throws XPathException
Report an error with diagnostic information

Parameters:
error - contains information about the error
Throws:
XPathException - always, after reporting the error to the ErrorListener

compileError

protected void compileError(String message)
                     throws XPathException
Report a static error in the stylesheet

Parameters:
message - the error message
Throws:
XPathException - always, after reporting the error to the ErrorListener

compileError

public void compileError(String message,
                         StructuredQName errorCode)
                  throws XPathException
Compile time error, specifying an error code

Parameters:
message - the error message
errorCode - the error code. May be null if not known or not defined
Throws:
XPathException - always, after reporting the error to the ErrorListener

compileError

public void compileError(String message,
                         String errorCode)
                  throws XPathException
Compile time error, specifying an error code

Parameters:
message - the error message
errorCode - the error code. May be null if not known or not defined
Throws:
XPathException - always, after reporting the error to the ErrorListener

undeclaredNamespaceError

protected void undeclaredNamespaceError(String prefix,
                                        String errorCode)
                                 throws XPathException
Throws:
XPathException

compileWarning

protected void compileWarning(String message,
                              StructuredQName errorCode)
                       throws XPathException
Throws:
XPathException

compileWarning

protected void compileWarning(String message,
                              String errorCode)
                       throws XPathException
Throws:
XPathException

issueWarning

protected void issueWarning(TransformerException error)
Report a warning to the error listener

Parameters:
error - an exception containing the warning text

issueWarning

protected void issueWarning(String message,
                            SourceLocator locator)
Report a warning to the error listener

Parameters:
message - the warning message text
locator - the location of the problem in the source stylesheet

isTopLevel

public boolean isTopLevel()
Test whether this is a top-level element

Returns:
true if the element is a child of the xsl:stylesheet element

bindVariable

public XSLVariableDeclaration bindVariable(StructuredQName qName)
Bind a variable used in this element to the compiled form of the XSLVariable element in which it is declared

Parameters:
qName - The name of the variable
Returns:
the XSLVariableDeclaration (that is, an xsl:variable or xsl:param instruction) for the variable, or null if no declaration of the variable can be found

bindLocalVariable

public XSLVariableDeclaration 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

Parameters:
qName - The name of the variable
Returns:
the XSLVariableDeclaration (that is, an xsl:variable or xsl:param instruction) for the variable, or null if no local declaration of the variable can be found

seesAvuncularVariables

protected boolean seesAvuncularVariables()
Ask whether variables declared in an "uncle" element are visible.

Returns:
true for all elements except xsl:fallback and saxon:catch

getConstructType

public int getConstructType()
Get the type of construct. This will be a constant in class Location. This method is part of the InstructionInfo interface

Specified by:
getConstructType in interface InstructionInfo
Returns:
an integer identifying the kind of construct

getObjectName

public 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. This is used only where the name is known statically. If there is no name, the value will be null.

Specified by:
getObjectName in interface InstructionInfo
Returns:
the name of the object declared in this element, if any

setObjectName

public void setObjectName(StructuredQName qName)
Set the object name, for example the name of a function, variable, or template declared on this element

Parameters:
qName - the object name as a QName

getProperty

public Object getProperty(String name)
Get the value of a particular property of the instruction. This is part of the 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.

Specified by:
getProperty in interface InstructionInfo
Parameters:
name - The name of the required property
Returns:
The value of the requested property, or null if the property is not available

getProperties

public Iterator<String> getProperties()
Get an iterator over all the properties available. The values returned by the iterator will be of type String, and each string can be supplied as input to the getProperty() method to retrieve the value of the property.

Specified by:
getProperties in interface InstructionInfo
Returns:
an iterator over the properties.

getSystemId

public String getSystemId(long locationId)
Description copied from interface: LocationProvider
Get the URI of the document, entity, or module containing a particular location

Specified by:
getSystemId in interface LocationProvider
Parameters:
locationId - identifier of the location in question (as passed down the Receiver pipeline)
Returns:
the URI of the document, XML entity or module. For a SourceLocationProvider this will be the URI of the document or entity (the URI that would be the base URI if there were no xml:base attributes). In other cases it may identify the query or stylesheet module currently being executed.

getLineNumber

public int getLineNumber(long locationId)
Description copied from interface: LocationProvider
Get the line number within the document, entity or module containing a particular location

Specified by:
getLineNumber in interface LocationProvider
Parameters:
locationId - identifier of the location in question (as passed down the Receiver pipeline)
Returns:
the line number within the document, entity or module, or -1 if no information is available.

getColumnNumber

public int getColumnNumber(long locationId)
Description copied from interface: LocationProvider
Get the column number within the document, entity, or module containing a particular location

Specified by:
getColumnNumber in interface LocationProvider
Parameters:
locationId - identifier of the location in question (as passed down the Receiver pipeline)
Returns:
the column number within the document, entity, or module, or -1 if this is not available

getHostLanguage

public int getHostLanguage()
Get the host language (XSLT, XQuery, XPath) used to implement the code in this container

Specified by:
getHostLanguage in interface Container
Returns:
typically Configuration.XSLT or Configuration.XQUERY

isActionCompleted

public boolean isActionCompleted(int action)
Ask if an action on this StyleElement has been completed

Parameters:
action - for example ACTION_VALIDATE
Returns:
true if the action has already been performed

setActionCompleted

public void setActionCompleted(int action)
Say that an action on this StyleElement has been completed

Parameters:
action - for example ACTION_VALIDATE

getSequenceNumber

protected final long getSequenceNumber()
Get the node sequence number (in document order). Sequence numbers are monotonic but not consecutive. In the current implementation, parent nodes (elements and document nodes) have a zero least-significant word, while namespaces, attributes, text nodes, comments, and PIs have the top word the same as their owner and the bottom half reflecting their relative position. For nodes added by XQUery Update, the sequence number is -1L

Overrides:
getSequenceNumber in class NodeImpl
Returns:
the sequence number if there is one, or -1L otherwise.

getRawSequenceNumber

protected final int getRawSequenceNumber()

setRawSequenceNumber

protected final void setRawSequenceNumber(int seq)

setChildren

protected final void setChildren(Object children)
Set the children of this node

Parameters:
children - null if there are no children, a single NodeInfo if there is one child, an array of NodeInfo if there are multiple children

hasChildNodes

public final boolean hasChildNodes()
Determine if the node has any children.

Specified by:
hasChildNodes in interface NodeInfo
Overrides:
hasChildNodes in class NodeImpl
Returns:
true if the node has any children, false if the node has no children.

getNumberOfChildren

public final int getNumberOfChildren()
Determine how many children the node has

Returns:
the number of children of this parent node

enumerateChildren

protected final AxisIterator enumerateChildren(NodeTest test)
Get an enumeration of the children of this node

Parameters:
test - A NodeTest to be satisfied by the child nodes, or null if all child node are to be returned
Returns:
an iterator over the children of this node

getFirstChild

public final NodeInfo getFirstChild()
Get the first child node of the element

Overrides:
getFirstChild in class NodeImpl
Returns:
the first child node of the required type, or null if there are no children

getLastChild

public final NodeInfo getLastChild()
Get the last child node of the element

Overrides:
getLastChild in class NodeImpl
Returns:
the last child of the element, or null if there are no children

getNthChild

protected final NodeImpl getNthChild(int n)
Get the nth child node of the element (numbering from 0)

Parameters:
n - identifies the required child
Returns:
the last child of the element, or null if there is no n'th child

removeChild

protected void removeChild(NodeImpl child)
Remove a given child

Parameters:
child - the child to be removed

getStringValue

public String getStringValue()
Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes.

Returns:
the accumulated character content of the element, including descendant elements.
See Also:
Item.getStringValueCS()

getStringValueCS

public CharSequence getStringValueCS()
Description copied from class: NodeImpl
Get the value of the item as a CharSequence. This is in some cases more efficient than the version of the method that returns a String.

Specified by:
getStringValueCS in interface Item<NodeInfo>
Specified by:
getStringValueCS in interface ValueRepresentation<NodeInfo>
Overrides:
getStringValueCS in class NodeImpl
Returns:
the string value of the item
See Also:
Item.getStringValue()

addChild

protected void addChild(NodeImpl node,
                        int index)
Add a child node to this node. For system use only. Note: normalizing adjacent text nodes is the responsibility of the caller.

Parameters:
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 added

insertChildren

public void insertChildren(NodeInfo[] source,
                           boolean atStart,
                           boolean inherit)
Insert a sequence of nodes as children of this node.

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.

Specified by:
insertChildren in interface MutableNodeInfo
Overrides:
insertChildren in class NodeImpl
Parameters:
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 children
inherit - true if the inserted nodes are to inherit the namespaces of their new parent; false if such namespaces are to be undeclared
Throws:
IllegalArgumentException - if the supplied nodes use a node implementation that this implementation does not accept.

insertChildrenAt

protected void insertChildrenAt(NodeInfo[] source,
                                int index,
                                boolean inherit)
Insert children before or after a given existing child

Parameters:
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 children

replaceChildrenAt

protected void replaceChildrenAt(NodeInfo[] source,
                                 int index,
                                 boolean inherit)
Replace child at a given index by new children

Parameters:
source - the children to be inserted
index - 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 range
inherit - set to true if the new child elements are to inherit the in-scope namespaces of their new parent
Throws:
IllegalArgumentException - if any of the replacement nodes is not an element, text, comment, or processing instruction node

compact

public void compact(int size)
Compact the space used by this node

Parameters:
size - the number of actual children


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.