Package org.exolab.adaptx.xslt
Class XSLTStylesheet
java.lang.Object
org.exolab.adaptx.xslt.XSLObject
org.exolab.adaptx.xslt.XSLTStylesheet
This class represents an XSL stylesheet
- Author:
- Keith Visco
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The current (and ever changing) XSLT namespaceFields inherited from class org.exolab.adaptx.xslt.XSLObject
APPLY_IMPORTS, APPLY_TEMPLATES, ARG, ATTRIBUTE, ATTRIBUTE_SET, CALL_TEMPLATE, CDATA, CHOOSE, COMMENT, CONTENTS, COPY, COPY_OF, ELEMENT, ENTITY_REF, FOR_EACH, FUNCTIONS, ID, IF, IMPORT, INCLUDE, KEY, LITERAL, LOCALE, MESSAGE, NUMBER, OTHERWISE, OUTPUT, PARAM, PI, PRESERVE_SPACE, SCRIPT, SORT, STRIP_SPACE, STYLESHEET, TEMPLATE, TEXT, VALUE_OF, VARIABLE, WHEN, WITH_PARAM
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttributeSet
(AttributeSet attributeSet) Adds the given AttributeSet to this stylesheetvoid
Adds a new Id to the list of IDs for this stylesheet for all elements.void
Adds a new Id for the specified element type to the list of IDs for this element type stylesheet.void
Adds a new Id for the specified element type to the list of IDs for this element type stylesheet.void
Adds a new top-level parameter to this stylesheet.void
Adds a new global level XSLScript to this stylesheet.void
addTemplate
(TemplateRule template) Adds a new TemplateRule to the list of rules for this stylesheet.void
addVariable
(Variable variable) Adds a new top-level Variable to this stylesheetboolean
appendAction
(XSLObject xslObject) Adds the given XSLObject to this Stylesheet.
The following elements are valid:int
getAttributeSet
(String setName) Returns all of the attribute-sets for this stylesheetReturns the document base for this stylesheetReturns an enumeration of the declared namespace prefixes for extension elementsgetHref()
getIds()
getNamedTemplate
(String name) Returns the TemplateRule whose name matches the given name argument.Returns an enumeration of templates that have namesReturns the XSLOutput Object for controlling the serialization of Result Documents created using this StylesheetgetParameter
(String name) Returns the top-level parameter associated with the given nameReturns an Enumeration of the top-level parametersgetQuotedNamespace
(String namespace) Returns the namespace that the given namespace argument quotesRetrieves the set of global level scripts for this stylesheetReturns the URILocation for this stylesheet, or null, if no location was set.getVariable
(String name) Returns the variable associated with the given nameReturns an Enumeration of the top-level variablesReturns the XSL Namespace Prefix for this XSL Stylesheetvoid
importFrom
(XSLImport xslImport) Imports the XSLStylesheet referenced by the given XSLImport to this stylesheet.void
importFrom
(XSLTStylesheet xsl) Imports the given XSLStylesheet to this XSLStylesheet.void
Includes the given XSLStylesheet to this XSLStylesheet.boolean
isAllowableImport
(String filename) Checks the given filename against this Stylesheet's href and previously imported stylesheets to determine if the file represented by the given filename can be imported in this stylesheet.boolean
isStripSpaceAllowed
(String name) Determines whether or not whitespace stripping is allowed for Elements with the given namevoid
preserveSpace
(String name) Preserves the whitespace of Elements with the given name.void
setAttribute
(String name, String value) Sets the attribute with the given name to the given value.void
setURILocation
(URILocation location) Sets the URILocation for this stylesheetvoid
stripSpace
(String name) Removes the ignorable whitespace from Elements with the given name.Methods inherited from class org.exolab.adaptx.xslt.XSLObject
addNamespaceDecl, appendText, appendText, getActions, getAttribute, getAttributes, getNamespace, getNearestAncestor, getNodeValue, getStylesheet, getText, getType, getTypeFromName, getTypeName, resolveNamespace, setAllowActions, setNamespace, setTypeName
-
Field Details
-
XSLT_NAMESPACE
The current (and ever changing) XSLT namespace- See Also:
-
-
Constructor Details
-
XSLTStylesheet
public XSLTStylesheet()Create a new XSLStylesheet
-
-
Method Details
-
addAttributeSet
Adds the given AttributeSet to this stylesheet- Parameters:
attributeSet
- the AttributeSet to add
-
addVariable
Adds a new top-level Variable to this stylesheet- Parameters:
variable
- the Variable to add- Throws:
XSLException
- when adding a Variable with the same name as a previously added Variable or Parameter.
-
addId
Adds a new Id to the list of IDs for this stylesheet for all elements.- Parameters:
idAttr
- the id attribute to add
-
addId
Adds a new Id for the specified element type to the list of IDs for this element type stylesheet.- Parameters:
idAttr
- the ID to addelementType
- the tag name of the element that id is an ID for Note: the wild card "*" will match all element types
-
addId
Adds a new Id for the specified element type to the list of IDs for this element type stylesheet.- Parameters:
id
- the Id to add
-
addParam
Adds a new top-level parameter to this stylesheet. The parameter may, or may not have a default value.- Parameters:
param
- the top-level parameter to add- Throws:
XSLException
- when adding a parameter with the same name as a previously declared parameter, or variable
-
addTemplate
Adds a new TemplateRule to the list of rules for this stylesheet.- Parameters:
rule
- the TemplateRule to add- Throws:
XSLException
- when a template already exists with the given name
-
addScript
Adds a new global level XSLScript to this stylesheet.
Note: This is currently a proprietary feature- Parameters:
script
- the XSLScript to add
-
appendAction
Adds the given XSLObject to this Stylesheet.
The following elements are valid:
xsl:attribute-set xsl:constant xsl:id xsl:import xsl:include xsl:macro xsl:template xsl:preserve-space xsl:strip-space The following proprietary elemens are also valid: xsl:script
- Overrides:
appendAction
in classXSLObject
- Parameters:
xslObject
- the XSLObject to add to this XSLObject's list of actions- Returns:
- true if the given XSLObject has been added to this XSLObject otherwise false
-
getAttributeSet
- Parameters:
setName
- the name of the attribute set to return- Returns:
- the AttributeSet for the given name, or null if not found.
- See Also:
-
getAttributeSets
Returns all of the attribute-sets for this stylesheet- Returns:
- all of the AttributeSets for this stylesheet
-
getDocumentBase
Returns the document base for this stylesheet- Returns:
- the document base for this stylesheet
-
getExtensionElementPrefixes
Returns an enumeration of the declared namespace prefixes for extension elements -
getURILocation
Returns the URILocation for this stylesheet, or null, if no location was set.- Returns:
- the URILocation for this stylesheet
- See Also:
-
getOutput
Returns the XSLOutput Object for controlling the serialization of Result Documents created using this Stylesheet- Returns:
- the Output Object for controlling the serialization of Result Documents created using this Stylesheet
-
getHref
- Returns:
- the href for this stylesheet
-
getIds
- Returns:
- a Vector of all the ID attributes for this Stylesheet
-
getLocalTemplates
- Returns:
- a Vector of the TemplateRule objects for this stylesheet, does not include imported TemplateRules.
-
getNamedTemplate
Returns the TemplateRule whose name matches the given name argument. Peter Ciuffetti. Added for WD-xslt-1990421- Parameters:
name
- the name of the NamedTemplate to return- Returns:
- the TemplateRule whose name matches the given name argument
- Since:
- WD-xslt-19990421
-
getNamedTemplates
Returns an enumeration of templates that have names- Returns:
- an enumeration of templates that have names
-
getParameter
Returns the top-level parameter associated with the given name- Parameters:
name
- the name of the top-level parameter to return- Returns:
- the top-level parameter associated with the given name
-
getParameters
Returns an Enumeration of the top-level parameters- Returns:
- the Enumeration of top-level parameter declarations
-
getVariable
Returns the variable associated with the given name- Parameters:
name
- the name of the variable to return- Returns:
- the variable associated with the given name
-
getVariables
Returns an Enumeration of the top-level variables- Returns:
- the Enumeration of top-level variable declarations
-
countTemplates
public int countTemplates()- Returns:
- the number of templates contained in this stylesheet, including imported rules
-
getQuotedNamespace
Returns the namespace that the given namespace argument quotes- Parameters:
namespace
- the namespace to resolve
-
getResultNamespace
-
getResultDocType
-
getScripts
Retrieves the set of global level scripts for this stylesheet- Returns:
- a List of XSLScript Objects
-
getTemplates
- Returns:
- an array of all the TemplateRule objects for this stylesheet, including imported templates
-
getXSLNSPrefix
Returns the XSL Namespace Prefix for this XSL Stylesheet- Returns:
- the XSL Namespace Prefix for this XSL Stylesheet
-
importFrom
Imports the given XSLStylesheet to this XSLStylesheet.- Parameters:
xsl
- the XSLStylesheet to import- Throws:
XSLException
-
importFrom
Imports the XSLStylesheet referenced by the given XSLImport to this stylesheet.- Parameters:
xslImport
- the XSLImport referencing the appropriate XSLStylesheet to import.- Throws:
XSLException
-
includeFrom
Includes the given XSLStylesheet to this XSLStylesheet.- Parameters:
xsl
- the XSLStylesheet to include- Throws:
XSLException
- See Also:
-
isAllowableImport
Checks the given filename against this Stylesheet's href and previously imported stylesheets to determine if the file represented by the given filename can be imported in this stylesheet.- Returns:
- true if the given filename is allowed to be included in this XSLStylesheet, otherwise false.
-
isStripSpaceAllowed
Determines whether or not whitespace stripping is allowed for Elements with the given name- Parameters:
name
- the name of the Element- See Also:
-
preserveSpace
Preserves the whitespace of Elements with the given name. By default all ignorable whitespace is removed for all Elements.- Parameters:
name
- the name of the Element to preserve whitespace of.- See Also:
-
setAttribute
Description copied from class:XSLObject
Sets the attribute with the given name to the given value.- Overrides:
setAttribute
in classXSLObject
- Parameters:
name
- the name of the attribute to setvalue
- the value to set the attribute to- Throws:
XSLException
- if this XSLObject does not allow attributes with the given name, or if the attribute is read only- See Also:
-
setURILocation
Sets the URILocation for this stylesheet- Parameters:
location
- the URILocation of this stylesheet
-
stripSpace
Removes the ignorable whitespace from Elements with the given name. By default all ignorable whitespace is removed for all Elements. This method should only be called if preserveSpace was previously called with the same name argument.- Parameters:
name
- the name of the Element to strip whitespace from- See Also:
-