net.sf.saxon.style
public class XSLStylesheet extends StyleElement
Modifier and Type | Field and Description |
---|---|
static int |
ANNOTATION_PRESERVE |
static int |
ANNOTATION_STRIP |
protected java.lang.Object |
children |
protected int |
sequence |
defaultCollationName, defaultXPathNamespace, extensionNamespaces, REPORT_ALWAYS, REPORT_IF_INSTANTIATED, REPORT_UNLESS_FALLBACK_AVAILABLE, REPORT_UNLESS_FORWARDS_COMPATIBLE, reportingCircumstances, staticContext, validationError, version
attributeList, nameCode, namespaceList, typeCode
index, NODE_LETTER, parent
ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES
Constructor and Description |
---|
XSLStylesheet() |
Modifier and Type | Method and Description |
---|---|
void |
addChild(NodeImpl node,
int index)
Add a child node to this node.
|
protected void |
addImportedSchema(java.lang.String targetNamespace) |
int |
allocateGlobalSlot(StructuredQName qName)
Allocate a slot number for a global variable or parameter
|
void |
allocatePatternSlots(int n)
Ensure there is enough space for local variables or parameters when evaluating the match pattern of
template rules
|
int |
allocateUniqueParameterNumber(StructuredQName qName)
Allocate a unique number to a local parameter name.
|
boolean |
allowsAllBuiltInTypes()
Determine whether the use of non-primitive built-in types has been enabled for this stylesheet
(This is relevant only for Saxon-B: such types are always permitted in Saxon-SA)
|
void |
compact(int size)
Compact the space used by this node
|
Expression |
compile(Executable exec)
Dummy compile() method to satisfy the interface
|
Executable |
compileStylesheet()
Compile the stylesheet to create an executable.
|
protected void |
declareJavaClass(java.lang.String uri,
java.lang.Class theClass)
Declare a URI that maps to a Java class containing extension functions
|
protected void |
declareXQueryFunction(XQueryFunction function)
Declare an imported XQuery function
|
protected AxisIterator |
enumerateChildren(NodeTest test)
Get an enumeration of the children of this node
|
protected StringCollator |
findCollation(java.lang.String name)
Find a named collation.
|
java.util.Properties |
gatherOutputProperties(StructuredQName formatQName)
Create an output properties object representing the xsl:output elements in the stylesheet.
|
XSLCharacterMap |
getCharacterMap(StructuredQName name)
Get a character map, identified by the fingerprint of its name.
|
CollationMap |
getCollationMap()
Get the collation map
|
DecimalFormatManager |
getDecimalFormatManager()
Get the DecimalFormatManager which handles decimal-format definitions
|
java.lang.String |
getDefaultCollationName()
Get the name of the default collation
|
int |
getDefaultValidation()
Get the value of the default validation attribute
|
Executable |
getExecutable()
Get the run-time Executable object
|
NodeInfo |
getFirstChild()
Get the first child node of the element
|
FunctionLibrary |
getFunctionLibrary()
Get the function library.
|
XSLVariableDeclaration |
getGlobalVariable(StructuredQName qName)
Get the global variable or parameter with a given name (taking
precedence rules into account)
|
protected java.util.HashSet |
getImportedSchemaTable() |
XSLStylesheet |
getImporter()
Get the StyleSheet that included or imported this one.
|
int |
getInputTypeAnnotations()
Get the value of the input-type-annotations attribute, for this module combined with that
of all included/imported modules.
|
int |
getInputTypeAnnotationsAttribute()
Get the value of the input-type-annotations attribute, for this module alone.
|
KeyManager |
getKeyManager()
Get the KeyManager which handles key definitions
|
NodeInfo |
getLastChild()
Get the last child node of the element
|
LocationMap |
getLocationMap()
Get the locationMap object
|
int |
getMinImportPrecedence()
Get the minimum import precedence of this stylesheet, that is, the lowest precedence
of any stylesheet imported by this one
|
protected int |
getNamespaceAlias(short uriCode)
Get the declared namespace alias for a given namespace URI code if there is one.
|
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
|
int |
getPrecedence()
Get the import precedence of this stylesheet
|
PreparedStylesheet |
getPreparedStylesheet()
Get the owning PreparedStylesheet object
|
RuleManager |
getRuleManager()
Get the RuleManager which handles template rules
|
protected long |
getSequenceNumber()
Get the node sequence number (in document order).
|
java.lang.String |
getStringValue()
Return the string-value of the node, that is, the concatenation
of the character content of all descendent elements and text nodes.
|
java.lang.CharSequence |
getStringValueCS()
Get the value of the item as a CharSequence.
|
protected Mode |
getStripperRules()
Get the rules determining which nodes are to be stripped from the tree
|
java.util.List |
getTopLevel()
Get the top level elements in this stylesheet, after applying include/import
|
boolean |
hasChildNodes()
Determine if the node has any children.
|
protected boolean |
hasNamespaceAliases() |
void |
insertChildren(NodeInfo[] source,
boolean atStart,
boolean inherit)
Insert copies of a sequence of nodes as children of this node.
|
protected void |
insertChildrenAt(NodeInfo[] source,
int index,
boolean inherit)
Insert children before or after a given existing child
|
protected boolean |
isAliasResultNamespace(short uriCode)
Determine if a namespace is included in the result-prefix of a namespace-alias
|
protected boolean |
isImportedSchema(java.lang.String targetNamespace)
Get an imported schema with a given namespace
|
protected boolean |
mayContainParam()
Determine whether this type of element is allowed to contain an xsl:param element
|
void |
prepareAttributes()
Prepare the attributes on the stylesheet element
|
void |
preprocess()
Preprocess does all the processing possible before the source document is available.
|
void |
processAllAttributes()
Process the attributes of every node in the stylesheet
|
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 |
setCollation(java.lang.String name,
StringCollator collation)
Register a named collation (actually a StringCollator)
|
void |
setImporter(XSLStylesheet importer)
Set the StyleSheet that included or imported this one.
|
void |
setInputTypeAnnotations(int annotations)
Set the value of the input-type-annotations attribute, for this module combined with that
of all included/imported modules.
|
void |
setMinImportPrecedence(int precedence)
Set the minimum import precedence of this stylesheet, that is, the lowest precedence
of any stylesheet imported by this one
|
void |
setNeedsDynamicOutputProperties(boolean b)
Set that this stylesheet needs dynamic output properties
|
void |
setPrecedence(int prec)
Set the import precedence of this stylesheet
|
void |
setPreparedStylesheet(PreparedStylesheet sheet)
Create link to the owning PreparedStylesheet object
|
void |
setWasIncluded()
Indicate that this stylesheet was included (by its "importer") using an xsl:include
statement as distinct from xsl:import
|
void |
spliceIncludes()
Process xsl:include and xsl:import elements.
|
boolean |
stripsWhitespace()
Determine whether this stylesheet does any whitespace stripping
|
protected void |
useChildrenArray(NodeImpl[] array)
Supply an array to be used for the array of children.
|
void |
validate()
Validate this element
|
allocateLocationId, allocatePatternSlots, allocateSlots, backwardsCompatibleModeIsEnabled, bindVariable, checkEmpty, checkSortComesFirst, checkTopLevel, checkUnknownAttribute, checkWithinTemplate, compileError, compileError, compileError, compileSequenceConstructor, compileWarning, definesExcludedNamespace, definesExtensionElement, fallbackProcessing, fixupReferences, forwardsCompatibleModeIsEnabled, getAllStylesheetFunctions, getAttributeSets, getAttributeValue, getColumnNumber, getCommonChildItemType, getConstructType, getContainingSlotManager, getContainingStylesheet, getDefaultXPathNamespace, getHostLanguage, getLastChildInstruction, getLineNumber, getLocationProvider, getNamespaceResolver, getObjectName, getPrincipalStylesheet, getProperties, getProperty, getReturnedItemType, getSchemaType, getStaticContext, getStylesheetFunction, getSystemId, getTypeAnnotation, getVersion, getWithParamInstructions, isExcludedNamespace, isExplaining, isExtensionNamespace, isInstruction, isPermittedChild, issueWarning, issueWarning, isTopLevel, makeAttributeValueTemplate, makeExpression, makeExpressionVisitor, makeNamespaceContext, makePattern, makeQName, makeSequenceType, makeSortKeys, makeTraceInstruction, markTailCalls, mayContainFallback, mayContainSequenceConstructor, postValidate, processAttributes, processDefaultCollationAttribute, processDefaultXPathNamespaceAttribute, processExcludedNamespaces, processExtensionElementAttribute, processVersionAttribute, replaceSubExpression, reportAbsence, setObjectName, setValidationError, substituteFor, typeCheck, typeCheck, undeclaredNamespaceError, validateChildren, validateSubtree
addNamespace, copy, delete, fixupInsertedNamespaces, generateId, getAttributeList, getAttributeValue, getAttributeValue, getBaseURI, getColumnNumber, getDeclaredNamespaces, getDocumentRoot, getInScopeNamespaceCodes, getLineNumber, getNameCode, getNodeKind, getPrefixForURI, getRoot, getSystemId, getTypeAnnotation, getURICodeForPrefix, getURICodeForPrefixCode, getURIForPrefix, initialise, isNilled, iteratePrefixes, putAttribute, removeAttribute, removeTypeAnnotation, rename, replaceStringValue, setLineAndColumn, setLocation, setNameCode, setNamespaceDeclarations, setSystemId, setTypeAnnotation
atomize, compareOrder, equals, getConfiguration, getDisplayName, getDocumentNumber, getFingerprint, getLineNumber, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPhysicalRoot, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getSiblingPosition, getTypedValue, getURI, insertSiblings, isId, isIdref, isSameNodeInfo, iterateAxis, iterateAxis, newBuilder, replace
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLineNumber, getSystemId
public static final int ANNOTATION_STRIP
public static final int ANNOTATION_PRESERVE
protected java.lang.Object children
protected int sequence
public void setPreparedStylesheet(PreparedStylesheet sheet)
sheet
- the PreparedStylesheetpublic PreparedStylesheet getPreparedStylesheet()
getPreparedStylesheet
in class StyleElement
public Executable getExecutable()
getExecutable
in interface Container
getExecutable
in class StyleElement
protected boolean mayContainParam()
StyleElement
mayContainParam
in class StyleElement
public FunctionLibrary getFunctionLibrary()
public LocationMap getLocationMap()
public RuleManager getRuleManager()
protected Mode getStripperRules()
public boolean stripsWhitespace()
public KeyManager getKeyManager()
public DecimalFormatManager getDecimalFormatManager()
public CollationMap getCollationMap()
public void setCollation(java.lang.String name, StringCollator collation)
name
- the name of the collationcollation
- the StringCollator that implements this collationprotected StringCollator findCollation(java.lang.String name)
name
- identifies the name of the collation required; null indicates that the default
collation is requiredpublic java.lang.String getDefaultCollationName()
getDefaultCollationName
in class StyleElement
public XSLCharacterMap getCharacterMap(StructuredQName name)
name
- The character map name being soughtpublic void setPrecedence(int prec)
prec
- the import precedence. Higher numbers indicate higher precedence, but the actual
number has no significancepublic int getPrecedence()
getPrecedence
in class StyleElement
public int getMinImportPrecedence()
public void setMinImportPrecedence(int precedence)
precedence
- the precedence of the first stylesheet module that this one importspublic void setImporter(XSLStylesheet importer)
importer
- the stylesheet module that included or imported this modulepublic XSLStylesheet getImporter()
public void setWasIncluded()
public java.util.List getTopLevel()
public int allocateGlobalSlot(StructuredQName qName)
qName
- the name of the variable or parameterpublic void allocatePatternSlots(int n)
n
- the number of slots to be allocatedpublic void prepareAttributes() throws XPathException
prepareAttributes
in class StyleElement
XPathException
public int getDefaultValidation()
Validation.STRIP
public int getInputTypeAnnotationsAttribute() throws XPathException
ANNOTATION_STRIP
and ANNOTATION_PRESERVE
XPathException
public int getInputTypeAnnotations()
ANNOTATION_STRIP
and ANNOTATION_PRESERVE
public void setInputTypeAnnotations(int annotations) throws XPathException
ANNOTATION_STRIP
and ANNOTATION_PRESERVE
annotations
- the value of the input-type-annotations attribute, for this module combined with that
of all included/imported modules.XPathException
public boolean allowsAllBuiltInTypes()
protected int getNamespaceAlias(short uriCode)
uriCode
- The code of the uri used in the stylesheet.protected boolean isAliasResultNamespace(short uriCode)
uriCode
- the namepool code of the URIpublic void validate() throws XPathException
validate
in class StyleElement
XPathException
public void preprocess() throws XPathException
XPathException
public void spliceIncludes() throws XPathException
XPathException
protected boolean hasNamespaceAliases()
public void processAllAttributes() throws XPathException
processAllAttributes
in class StyleElement
XPathException
- in the event of a static error being detectedpublic XSLVariableDeclaration getGlobalVariable(StructuredQName qName)
qName
- name of the global variable or parameterpublic void setNeedsDynamicOutputProperties(boolean b)
b
- true if this stylesheet needs dynamic output propertiespublic java.util.Properties gatherOutputProperties(StructuredQName formatQName) throws XPathException
formatQName
- The name of the output format required. If set to null, gathers
information for the unnamed output formatXPathException
- if a named output format does not exist in
the stylesheetprotected void declareXQueryFunction(XQueryFunction function) throws XPathException
function
- the imported functionXPathException
protected void declareJavaClass(java.lang.String uri, java.lang.Class theClass)
uri
- the namespace uri used in the function namestheClass
- the Java class containing methods accessible using this URIprotected boolean isImportedSchema(java.lang.String targetNamespace)
targetNamespace
- The target namespace of the required schema.
Supply an empty string for the default namespaceprotected void addImportedSchema(java.lang.String targetNamespace)
protected java.util.HashSet getImportedSchemaTable()
public Executable compileStylesheet() throws XPathException
XPathException
public Expression compile(Executable exec)
compile
in class StyleElement
exec
- the Executablepublic int allocateUniqueParameterNumber(StructuredQName qName)
qName
- the local parameter nameprotected final long getSequenceNumber()
getSequenceNumber
in class NodeImpl
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 int getNumberOfChildren()
protected final AxisIterator enumerateChildren(NodeTest test)
test
- A NodeTest to be satisfied by the child nodes, or null
if all child node are to be returnedpublic final NodeInfo getFirstChild()
getFirstChild
in class NodeImpl
public final NodeInfo getLastChild()
getLastChild
in class NodeImpl
protected final NodeImpl getNthChild(int n)
n
- identifies the required childprotected void removeChild(NodeImpl child)
child
- the child to be removedpublic java.lang.String getStringValue()
Item.getStringValueCS()
public java.lang.CharSequence getStringValueCS()
NodeImpl
getStringValueCS
in interface Item
getStringValueCS
in interface ValueRepresentation
getStringValueCS
in class NodeImpl
Item.getStringValue()
protected void useChildrenArray(NodeImpl[] array)
array
- the array to be usedpublic 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 insertChildren(NodeInfo[] source, boolean atStart, boolean inherit)
This method takes no action unless the target node is a document node or element node. It also takes no action in respect of any supplied nodes that are not elements, text nodes, comments, or processing instructions.
The supplied nodes will be copied to form the new children. Adjacent text nodes will be merged, and zero-length text nodes removed.
insertChildren
in interface MutableNodeInfo
insertChildren
in class NodeImpl
source
- the nodes to be insertedatStart
- true if the new nodes are to be inserted before existing children; false if they areinherit
- true if the inserted nodes are to inherit the namespaces that are in-scope for their
new parent; false if such namespaces should be undeclared on the childrenprotected void insertChildrenAt(NodeInfo[] source, int index, boolean inherit)
source
- the children to be insertedindex
- the position before which they are to be inserted: 0 indicates insertion before the
first child, 1 insertion before the second child, and so on.inherit
- true if the inserted nodes are to inherit the namespaces that are in-scope for their
new parent; false if such namespaces should be undeclared on the childrenprotected void replaceChildrenAt(NodeInfo[] source, int index, boolean inherit)
source
- the children to be insertedindex
- the position at which they are to be inserted: 0 indicates replacement of the
first child, replacement of the second child, and so on. The effect is undefined if index
is out of rangeinherit
- set to true if the new child elements are to inherit the in-scope namespaces
of their new parentjava.lang.IllegalArgumentException
- if any of the replacement nodes is not an element, text,
comment, or processing instruction nodepublic void compact(int size)
size
- the number of actual children