|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.tree.NodeImpl
net.sf.saxon.tree.ParentNodeImpl
net.sf.saxon.tree.ElementImpl
net.sf.saxon.tree.ElementWithAttributes
net.sf.saxon.style.StyleElement
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 XSL error is found.
Field Summary | |
protected java.lang.String |
defaultCollationName
|
protected java.lang.String |
defaultXPathNamespace
|
protected short[] |
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 StaticContext |
staticContext
|
protected StaticError |
validationError
|
protected java.math.BigDecimal |
version
|
Fields inherited from class net.sf.saxon.tree.ElementWithAttributes |
attributeList, namespaceList |
Fields inherited from class net.sf.saxon.tree.ElementImpl |
nameCode, root, sequence |
Fields inherited from class net.sf.saxon.tree.NodeImpl |
index, NODE_LETTER, parent |
Fields inherited from interface net.sf.saxon.om.NodeInfo |
ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, LOCAL_NAMESPACES, NO_NAMESPACES |
Fields inherited from interface net.sf.saxon.om.ValueRepresentation |
EMPTY_VALUE_ARRAY |
Constructor Summary | |
StyleElement()
Constructor |
Method Summary | |
int |
allocateLocationId(java.lang.String systemId,
int lineNumber)
Allocate a location identifier |
void |
allocateSlots(Expression exp)
Allocate slots in the local stack frame to range variables used in an XPath expression |
boolean |
backwardsCompatibleModeIsEnabled()
Determine whether backwards-compatible mode is enabled for this element |
XSLVariableDeclaration |
bindVariable(int fingerprint)
Bind a variable used in this element to the compiled form of the XSLVariable element in which it is declared |
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(java.lang.String errorCode)
Convenience method to check that the stylesheet element is at the top level |
protected void |
checkUnknownAttribute(int nc)
Check whether an unknown attribute is permitted. |
void |
checkWithinTemplate()
Check that the stylesheet element is within a sequence constructor |
abstract Expression |
compile(Executable exec)
Compile the instruction on the stylesheet tree into an executable instruction for use at run-time. |
protected void |
compileError(java.lang.String message)
|
protected void |
compileError(java.lang.String message,
java.lang.String errorCode)
Compile time error, specifying an error code |
protected void |
compileError(javax.xml.transform.TransformerException error)
Construct an exception with diagnostic information |
Expression |
compileSequenceConstructor(Executable exec,
AxisIterator 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(java.lang.String message,
java.lang.String errorCode)
|
protected boolean |
definesExcludedNamespace(short uriCode)
Check whether this node excludes a particular namespace from the result. |
protected boolean |
definesExtensionElement(short uriCode)
Check whether a particular extension element namespace is defined on this node. |
protected Expression |
fallbackProcessing(Executable exec,
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(java.lang.String use,
java.util.List list)
Get the list of attribute-sets associated with this element. |
java.lang.String |
getAttributeValue(java.lang.String clarkName)
Get an attribute value given the Clark name of the attribute (that is, the name in {uri}local format). |
protected ItemType |
getCommonChildItemType()
Get the most general type of item returned by the children of this instruction |
int |
getConstructType()
Get the type of construct. |
SlotManager |
getContainingSlotManager()
Get the SlotManager for the containing Procedure definition |
XSLStylesheet |
getContainingStylesheet()
Get the containing XSLStylesheet element |
protected java.lang.String |
getDefaultCollationName()
Get the default collation for this element |
protected short |
getDefaultXPathNamespace()
Get the default XPath namespace code applicable to this element |
Executable |
getExecutable()
Get the Executable (representing a complete stylesheet or query) of which this Container forms part |
int |
getHostLanguage()
Get the host language (XSLT, XQuery, XPath) used to implement the code in this container |
protected StyleElement |
getLastChildInstruction()
Find the last child instruction of this instruction. |
int |
getLineNumber()
Return the line number where the current document event ends. |
int |
getLineNumber(int locationId)
|
LocationProvider |
getLocationProvider()
Get the LocationProvider allowing location identifiers to be resolved. |
NamespaceResolver |
getNamespaceResolver()
Get the namespace context of the instruction. |
int |
getObjectFingerprint()
Get a fingerprint identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc. |
int |
getObjectNameCode()
Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc. |
int |
getPrecedence()
Get the import precedence of this stylesheet element. |
PreparedStylesheet |
getPreparedStylesheet()
Get the PreparedStylesheet object. |
protected XSLStylesheet |
getPrincipalStylesheet()
Get the principal XSLStylesheet node. |
java.util.Iterator |
getProperties()
Get an iterator over all the properties available. |
java.lang.Object |
getProperty(java.lang.String name)
Get the value of a particular property of the instruction. |
protected ItemType |
getReturnedItemType()
Determine the type of item returned by this instruction (only relevant if it is an instruction). |
SchemaType |
getSchemaType(java.lang.String typeAtt)
Get the Schema type definition for a type named in the stylesheet (in a "type" attribute). |
StaticContext |
getStaticContext()
Get the static context for expressions on this element |
XSLFunction |
getStylesheetFunction(int fingerprint,
int arity)
Get a FunctionCall declared using an xsl:function element in the stylesheet |
java.lang.String |
getSystemId(int locationId)
|
NamePool |
getTargetNamePool()
Get the namepool to be used at run-time, this namepool holds the names used in all XPath expressions and patterns |
int |
getTypeAnnotation(SchemaType schemaType)
Get the type annotation to use for a given schema type |
java.math.BigDecimal |
getVersion()
Get the numeric value of the version number on this element, or inherited from its ancestors |
protected WithParam[] |
getWithParamInstructions(Executable exec,
boolean tunnel,
Instruction caller)
Get the list of xsl:with-param elements for a calling element (apply-templates, call-template, apply-imports, next-match). |
boolean |
isExcludedNamespace(short uriCode)
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(short uriCode)
Check whether a namespace uri defines an extension element. |
boolean |
isInstruction()
Determine whether this node is an instruction. |
protected boolean |
isPermittedChild(StyleElement child)
Specify that certain children are permitted for this element |
protected void |
issueWarning(java.lang.String message,
javax.xml.transform.SourceLocator locator)
|
protected void |
issueWarning(javax.xml.transform.TransformerException error)
Construct an exception with diagnostic information |
boolean |
isTopLevel()
Test whether this is a top-level element |
Expression |
makeAttributeValueTemplate(java.lang.String expression)
Make an attribute value template in the context of this stylesheet element |
Expression |
makeExpression(java.lang.String expression)
Make an expression in the context of this stylesheet element |
int |
makeNameCode(java.lang.String qname)
Make a NameCode, using this Element as the context for namespace resolution, and registering the code in the namepool. |
SavedNamespaceContext |
makeNamespaceContext()
Make a NamespaceContext object representing the list of in-scope namespaces. |
Pattern |
makePattern(java.lang.String pattern)
Make a pattern in the context of this stylesheet element |
SequenceType |
makeSequenceType(java.lang.String sequenceType)
Process an attribute whose value is a SequenceType |
protected SortKeyDefinition[] |
makeSortKeys()
Construct sort keys for a SortedIterator |
protected static TraceWrapper |
makeTraceInstruction(StyleElement source,
Expression child)
Create a trace instruction to wrap a real instruction |
void |
markTailCalls()
Mark tail-recursive calls on templates and functions. |
boolean |
mayContainFallback()
Determine whether this type of element is allowed to contain an xsl:fallback instruction |
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. |
abstract void |
prepareAttributes()
Set the attribute list for the element. |
void |
processAllAttributes()
Process the attributes of this element and all its children |
void |
processAttributes()
Process the attribute list for the element. |
protected void |
processDefaultCollationAttribute(java.lang.String nc)
Process the [xsl:]default-xpath-namespace attribute if there is one |
protected void |
processDefaultXPathNamespaceAttribute(java.lang.String nc)
Process the [xsl:]default-xpath-namespace attribute if there is one |
protected void |
processExcludedNamespaces(java.lang.String nc)
Process the [xsl:]exclude-result-prefixes attribute if there is one |
protected void |
processExtensionElementAttribute(java.lang.String nc)
Process the [xsl:]extension-element-prefixes attribute if there is one |
protected void |
processVersionAttribute(java.lang.String nc)
Process the [xsl:]version attribute if there is one |
void |
reportAbsence(java.lang.String attribute)
Convenience method to report the absence of a mandatory attribute |
void |
setLineNumber(int lineNumber)
Set the line number of the element within its source document entity |
void |
setObjectNameCode(int nameCode)
Set the object name code |
protected void |
setValidationError(javax.xml.transform.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(java.lang.String name,
Expression exp)
Type-check an expression. |
Pattern |
typeCheck(java.lang.String name,
Pattern pattern)
Type-check a pattern. |
protected void |
undeclaredNamespaceError(java.lang.String prefix,
java.lang.String errorCode)
|
void |
validate()
Check that the stylesheet element is valid. |
protected void |
validateChildren()
Validate the children of this node, recursively. |
void |
validateSubtree()
Recursive walk through the stylesheet to validate all nodes |
Methods inherited from class net.sf.saxon.tree.ElementWithAttributes |
copy, getAttributeList, getAttributeValue, getDeclaredNamespaces, getInScopeNamespaceCodes, getPrefixForURI, getURICodeForPrefix, getURIForPrefix, initialise, iteratePrefixes, sendNamespaceDeclarations, setNamespaceDeclarations |
Methods inherited from class net.sf.saxon.tree.ElementImpl |
addChild, compact, enumerateChildren, generateId, getBaseURI, getDocumentRoot, getFirstChild, getLastChild, getNameCode, getNodeKind, getNthChild, getRoot, getSequenceNumber, getStringValue, getStringValueCS, getSystemId, hasChildNodes, setNameCode, setSystemId, useChildrenArray |
Methods inherited from class net.sf.saxon.tree.NodeImpl |
atomize, compareOrder, equals, getColumnNumber, getConfiguration, getDisplayName, getDocumentNumber, getFingerprint, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getTypeAnnotation, getTypedValue, getURI, hashCode, isSameNodeInfo, iterateAxis, iterateAxis |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.xml.sax.Locator |
getColumnNumber, getPublicId, getSystemId |
Methods inherited from interface javax.xml.transform.SourceLocator |
getColumnNumber, getPublicId, getSystemId |
Methods inherited from interface net.sf.saxon.trace.InstructionInfo |
getSystemId |
Field Detail |
protected short[] extensionNamespaces
protected java.math.BigDecimal version
protected StaticContext staticContext
protected StaticError validationError
protected int reportingCircumstances
protected java.lang.String defaultXPathNamespace
protected java.lang.String defaultCollationName
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
Constructor Detail |
public StyleElement()
Method Detail |
public Executable getExecutable()
Container
getExecutable
in interface Container
public LocationProvider getLocationProvider()
getLocationProvider
in interface Container
public NamePool getTargetNamePool()
public StaticContext getStaticContext()
public int getLineNumber()
org.xml.sax.Locator
Warning: The return value from the method is intended only as an approximation for the sake of error reporting; it is not intended to provide sufficient information to edit the character content of the original XML document.
The return value is an approximation of the line number in the document entity or external parsed entity where the markup triggering the event appears.
If possible, the SAX driver should provide the line position of the first character after the text associated with the document event. The first line in the document is line 1.
getLineNumber
in interface org.xml.sax.Locator
getLineNumber
in class ElementImpl
public void setLineNumber(int lineNumber)
ElementImpl
setLineNumber
in class ElementImpl
protected boolean isExplaining()
public void substituteFor(StyleElement temp)
protected void setValidationError(javax.xml.transform.TransformerException reason, int circumstances)
public boolean isInstruction()
protected ItemType getReturnedItemType()
protected ItemType getCommonChildItemType()
public void markTailCalls()
public boolean mayContainSequenceConstructor()
public boolean mayContainFallback()
public XSLStylesheet getContainingStylesheet()
public int getPrecedence()
public final int makeNameCode(java.lang.String qname) throws XPathException, NamespaceException
qname
- The name as written, in the form "[prefix:]localname". The name must have
already been validated as a syntactically-correct QName.
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 SavedNamespaceContext makeNamespaceContext()
public void processAllAttributes() throws XPathException
XPathException
public java.lang.String getAttributeValue(java.lang.String clarkName)
public final void processAttributes() throws XPathException
XPathException
protected void checkUnknownAttribute(int nc) throws XPathException
nc
- The name code of the attribute name
XPathException
public abstract void prepareAttributes() throws XPathException
XPathException
protected StyleElement getLastChildInstruction()
public Expression makeExpression(java.lang.String expression) throws XPathException
XPathException
public Pattern makePattern(java.lang.String pattern) throws XPathException
XPathException
public Expression makeAttributeValueTemplate(java.lang.String expression) throws XPathException
XPathException
public SequenceType makeSequenceType(java.lang.String sequenceType) throws XPathException
XPathException
protected void processExtensionElementAttribute(java.lang.String nc) throws XPathException
nc
- the Clark name of the attribute required
XPathException
protected void processExcludedNamespaces(java.lang.String nc) throws XPathException
nc
- the Clark name of the attribute required
XPathException
protected void processVersionAttribute(java.lang.String nc) throws XPathException
nc
- the Clark name of the attribute required
XPathException
public java.math.BigDecimal getVersion()
public boolean forwardsCompatibleModeIsEnabled()
public boolean backwardsCompatibleModeIsEnabled()
protected void processDefaultCollationAttribute(java.lang.String nc) throws XPathException
nc
- the Clark name of the attribute required
XPathException
protected java.lang.String getDefaultCollationName()
protected boolean definesExtensionElement(short uriCode)
uriCode
- the namespace URI code being testedpublic boolean isExtensionNamespace(short uriCode)
uriCode
- the namespace URI code being testedprotected boolean definesExcludedNamespace(short uriCode)
uriCode
- the code of the namespace URI being testedpublic boolean isExcludedNamespace(short uriCode)
uriCode
- the code of the namespace URI being testedprotected void processDefaultXPathNamespaceAttribute(java.lang.String nc)
nc
- the Clark name of the attribute requiredprotected short getDefaultXPathNamespace()
public SchemaType getSchemaType(java.lang.String typeAtt) throws XPathException
XPathException
- if the type is not declared in an
imported schema, or is not a built-in typepublic int getTypeAnnotation(SchemaType schemaType)
public void validate() throws XPathException
XPathException
public void postValidate() throws XPathException
XPathException
public Expression typeCheck(java.lang.String name, Expression exp) throws XPathException
XPathException
public void allocateSlots(Expression exp)
exp
- the XPath expression for which slots are to be allocatedpublic Pattern typeCheck(java.lang.String name, Pattern pattern) throws XPathException
XPathException
public void fixupReferences() throws XPathException
XPathException
public SlotManager getContainingSlotManager()
public void validateSubtree() throws XPathException
XPathException
protected void validateChildren() throws XPathException
XPathException
protected boolean isPermittedChild(StyleElement child)
protected XSLStylesheet getPrincipalStylesheet()
public PreparedStylesheet getPreparedStylesheet()
public void checkWithinTemplate() throws XPathException
XPathException
- if not within a sequence constructorprotected void checkSortComesFirst(boolean sortRequired) throws XPathException
sortRequired
- true if there must be at least one xsl:sort element
XPathException
- if invalidpublic void checkTopLevel(java.lang.String errorCode) throws XPathException
XPathException
- if not at top levelpublic void checkEmpty() throws XPathException
XPathException
- if it is not emptypublic void reportAbsence(java.lang.String attribute) throws XPathException
XPathException
- if the attribute is missingpublic abstract Expression compile(Executable exec) throws XPathException
XPathException
public Expression compileSequenceConstructor(Executable exec, AxisIterator iter, boolean includeParams) throws XPathException
XPathException
protected static TraceWrapper makeTraceInstruction(StyleElement source, Expression child)
protected Expression fallbackProcessing(Executable exec, StyleElement instruction) throws XPathException
instruction
- The unknown extension instruction
XPathException
public int allocateLocationId(java.lang.String systemId, int lineNumber)
protected SortKeyDefinition[] makeSortKeys()
protected AttributeSet[] getAttributeSets(java.lang.String use, java.util.List list) throws XPathException
use
- the original value of the [xsl:]use-attribute-sets attributelist
- an empty list to hold the list of XSLAttributeSet elements in the stylesheet tree.
Or null, if these are not required.
XPathException
protected WithParam[] getWithParamInstructions(Executable exec, boolean tunnel, Instruction caller) throws XPathException
tunnel
- true if the tunnel="yes" parameters are wanted, false to getcaller
-
XPathException
protected void compileError(javax.xml.transform.TransformerException error) throws XPathException
XPathException
protected void compileError(java.lang.String message) throws XPathException
XPathException
protected void compileError(java.lang.String message, java.lang.String errorCode) throws XPathException
message
- the error messageerrorCode
- the error code. May be null if not known or not defined
XPathException
protected void undeclaredNamespaceError(java.lang.String prefix, java.lang.String errorCode) throws XPathException
XPathException
protected void compileWarning(java.lang.String message, java.lang.String errorCode) throws XPathException
XPathException
protected void issueWarning(javax.xml.transform.TransformerException error)
protected void issueWarning(java.lang.String message, javax.xml.transform.SourceLocator locator)
public boolean isTopLevel()
public XSLVariableDeclaration bindVariable(int fingerprint) throws StaticError
fingerprint
- The fingerprint of the name of the variable
StaticError
- if the variable has not been declaredpublic XSLFunction getStylesheetFunction(int fingerprint, int arity)
fingerprint
- the fingerprint of the name of the functionarity
- the number of arguments in the function call. The value -1
indicates that any arity will do (this is used to support the function-available() function).
public int getConstructType()
Location
. This method is part of the InstructionInfo
interface
getConstructType
in interface InstructionInfo
public int getObjectNameCode()
getObjectNameCode
in interface InstructionInfo
public int getObjectFingerprint()
public void setObjectNameCode(int nameCode)
public NamespaceResolver getNamespaceResolver()
getNamespaceResolver
in interface InstructionInfo
public java.lang.Object getProperty(java.lang.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.
getProperty
in interface InstructionInfo
name
- The name of the required property
public java.util.Iterator getProperties()
getProperties
in interface InstructionInfo
public java.lang.String getSystemId(int locationId)
getSystemId
in interface LocationProvider
public int getLineNumber(int locationId)
getLineNumber
in interface LocationProvider
public int getHostLanguage()
getHostLanguage
in interface Container
Configuration.XSLT
or Configuration.XQUERY
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |