|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.tree.NodeImpl net.sf.saxon.tree.ElementImpl net.sf.saxon.tree.ElementWithAttributes net.sf.saxon.style.StyleElement
public abstract class 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 | |
---|---|
static int |
REPORT_ALWAYS
|
static int |
REPORT_IF_INSTANTIATED
|
static int |
REPORT_UNLESS_FALLBACK_AVAILABLE
|
static int |
REPORT_UNLESS_FORWARDS_COMPATIBLE
|
Fields inherited from class net.sf.saxon.tree.NodeImpl |
---|
NODE_LETTER |
Fields inherited from interface net.sf.saxon.om.NodeInfo |
---|
ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES |
Fields inherited from interface net.sf.saxon.om.ValueRepresentation |
---|
EMPTY_VALUE_ARRAY |
Constructor Summary | |
---|---|
StyleElement()
Constructor |
Method Summary | |
---|---|
void |
addChild(NodeImpl node,
int index)
Add a child node to this node. |
void |
allocatePatternSlots(Pattern match,
SlotManager frame)
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 |
void |
allocateSlots(Pattern pattern)
Allocate slots to any variables used within a pattern. |
boolean |
backwardsCompatibleModeIsEnabled()
Determine whether backwards-compatible mode is enabled for this element |
XSLVariableDeclaration |
bindVariable(StructuredQName qName)
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 |
void |
checkTopLevel(String errorCode)
Convenience method to check that the stylesheet element is at the top level |
void |
checkWithinTemplate()
Check that the stylesheet element is within a sequence constructor |
void |
compact(int size)
Compact the space used by this node |
abstract Expression |
compile(Executable exec)
Compile the instruction on the stylesheet tree into an executable instruction for use at run-time. |
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. |
void |
fixupReferences()
Fix up references from XPath expressions. |
boolean |
forwardsCompatibleModeIsEnabled()
Determine whether forwards-compatible mode is enabled for this element |
List |
getAllStylesheetFunctions()
Get a list of all stylesheet functions, excluding any that are masked by one of higher precedence |
String |
getAttributeValue(String clarkName)
Get an attribute value given the Clark name of the attribute (that is, the name in {uri}local format). |
int |
getConstructType()
Get the type of construct. |
SlotManager |
getContainingSlotManager()
Get the SlotManager for the containing Procedure definition |
XSLStylesheet |
getContainingStylesheet()
Get the containing XSLStylesheet element |
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 |
int |
getLineNumber()
Get the line number of the node within its source document entity |
int |
getLineNumber(long locationId)
Get the line number within the document 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. |
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. |
StructuredQName |
getObjectName(NamePool pool)
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. |
XSLStylesheet |
getPrincipalStylesheet()
Get the principal XSLStylesheet node. |
Iterator |
getProperties()
Get an iterator over all the properties available. |
Object |
getProperty(String name)
Get the value of a particular property of the instruction. |
SchemaType |
getSchemaType(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 |
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. |
XSLFunction |
getStylesheetFunction(StructuredQName qName,
int arity)
Get a FunctionCall declared using an xsl:function element in the stylesheet |
String |
getSystemId(long locationId)
Get the URI of the document or module containing a particular location |
int |
getTypeAnnotation(SchemaType schemaType)
Get the type annotation to use for a given schema type |
BigDecimal |
getVersion()
Get the numeric value of the version number on this element, or inherited from its ancestors |
boolean |
hasChildNodes()
Determine if the node has any children. |
boolean |
isExcludedNamespace(short uriCode)
Check whether a namespace uri defines an namespace excluded from the result. |
boolean |
isExtensionNamespace(short uriCode)
Check whether a namespace uri defines an extension element. |
boolean |
isInstruction()
Determine whether this node is an instruction. |
boolean |
isTopLevel()
Test whether this is a top-level 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 |
void |
postValidate()
Hook to allow additional validation of a parent element immediately after its children have been validated. |
boolean |
replaceSubExpression(Expression original,
Expression replacement)
Replace one subexpression by a replacement subexpression |
void |
reportAbsence(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 |
setObjectName(StructuredQName qName)
Set the object name, for example the name of a function, variable, or template declared on this element |
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. |
void |
validate()
Check that the stylesheet element is valid. |
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, setNamespaceDeclarations |
Methods inherited from class net.sf.saxon.tree.ElementImpl |
---|
generateId, getBaseURI, getDocumentRoot, getNameCode, getNodeKind, getRoot, getSystemId, setNameCode, setSystemId |
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 |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.saxon.trace.InstructionInfo |
---|
getSystemId |
Field Detail |
---|
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 StaticContext getStaticContext()
public ExpressionVisitor makeExpressionVisitor()
public int getLineNumber()
ElementImpl
getLineNumber
in interface SourceLocator
getLineNumber
in interface NodeInfo
getLineNumber
in interface InstructionInfo
getLineNumber
in interface Locator
getLineNumber
in class ElementImpl
public void setLineNumber(int lineNumber)
ElementImpl
setLineNumber
in class ElementImpl
lineNumber
- the line numberpublic void substituteFor(StyleElement temp)
temp
- the element which this one is substituting forpublic boolean isInstruction()
public XSLStylesheet getContainingStylesheet()
public int getPrecedence()
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
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 NamespaceResolver getNamespaceResolver()
getNamespaceResolver
in interface InstructionInfo
public String getAttributeValue(String clarkName)
clarkName
- the name of the attribute in {uri}local format
public Expression makeExpression(String expression) throws XPathException
expression
- the source text of the XPath expression
XPathException
public Pattern makePattern(String pattern) throws XPathException
pattern
- the source text of the pattern
XPathException
public SequenceType makeSequenceType(String sequenceType) throws XPathException
sequenceType
- the source text of the attribute
XPathException
- if the syntax is invalid or for example if it refers to a type
that is not in the static contextpublic BigDecimal getVersion()
public boolean forwardsCompatibleModeIsEnabled()
public boolean backwardsCompatibleModeIsEnabled()
public boolean isExtensionNamespace(short uriCode)
uriCode
- the namespace URI code being tested
public boolean isExcludedNamespace(short uriCode)
uriCode
- the code of the namespace URI being tested
public SchemaType getSchemaType(String typeAtt) throws XPathException
typeAtt
- the value of the type attribute
XPathException
- if the type is not declared in an
imported schema, or is not a built-in typepublic int getTypeAnnotation(SchemaType schemaType)
schemaType
- the schema type
public void validate() throws XPathException
XPathException
public void postValidate() throws XPathException
XPathException
public 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 checked
XPathException
public void allocateSlots(Expression exp)
exp
- the XPath expression for which slots are to be allocatedpublic void allocateSlots(Pattern pattern)
pattern
- the pattern whose slots are to be allocatedpublic void allocatePatternSlots(Pattern match, SlotManager frame)
match
- the patternframe
- the stackframe outline for this patternpublic 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 pattern
XPathException
public void fixupReferences() throws XPathException
XPathException
public SlotManager getContainingSlotManager()
public void validateSubtree() throws XPathException
XPathException
public XSLStylesheet getPrincipalStylesheet()
public PreparedStylesheet getPreparedStylesheet()
public void checkWithinTemplate() throws XPathException
XPathException
- if not within a sequence constructorpublic void checkTopLevel(String errorCode) throws XPathException
errorCode
- the error to throw if it is not at the top level; defaults to XTSE0010
if the value is null
XPathException
- 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 reported
XPathException
- if the attribute is missingpublic abstract Expression compile(Executable exec) throws XPathException
exec
- the Executable
XPathException
public Expression compileSequenceConstructor(Executable exec, AxisIterator iter, boolean includeParams) throws XPathException
exec
- the Executableiter
- 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
public boolean isTopLevel()
public XSLVariableDeclaration bindVariable(StructuredQName qName) throws XPathException
qName
- The name of the variable
XPathException
- if the variable has not been declaredpublic XSLFunction getStylesheetFunction(StructuredQName qName, int arity)
qName
- 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 List getAllStylesheetFunctions()
public int getConstructType()
Location
. This method is part of the InstructionInfo
interface
getConstructType
in interface InstructionInfo
public StructuredQName getObjectName(NamePool pool)
getObjectName
in interface InstructionInfo
pool
- the name pool (not needed in this implementation of the method)public 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.
getProperty
in interface InstructionInfo
name
- The name of the required property
public Iterator getProperties()
getProperties
in interface InstructionInfo
public String getSystemId(long locationId)
LocationProvider
getSystemId
in interface LocationProvider
locationId
- identifier of the location in question (as passed down the Receiver pipeline)
public int getLineNumber(long locationId)
LocationProvider
getLineNumber
in interface LocationProvider
locationId
- identifier of the location in question (as passed down the Receiver pipeline)
public int getHostLanguage()
getHostLanguage
in interface Container
Configuration.XSLT
or Configuration.XQUERY
public boolean replaceSubExpression(Expression original, Expression replacement)
replaceSubExpression
in interface Container
original
- the original subexpressionreplacement
- the replacement subexpression
public 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 NodeInfo getFirstChild()
getFirstChild
in class NodeImpl
public final NodeInfo getLastChild()
getLastChild
in class NodeImpl
public String getStringValue()
Item.getStringValueCS()
public CharSequence getStringValueCS()
NodeImpl
getStringValueCS
in interface Item
getStringValueCS
in interface ValueRepresentation
getStringValueCS
in class NodeImpl
Item.getStringValue()
public void addChild(NodeImpl node, int index)
node
- the node to be added as a child of this nodeindex
- the position where the child is to be addedpublic void compact(int size)
size
- the number of actual children
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |