org.exolab.adaptx.xslt

Class XSLTStylesheet

public class XSLTStylesheet extends XSLObject

This class represents an XSL stylesheet

Author: Keith Visco

Field Summary
static StringXSLT_NAMESPACE
The current (and ever changing) XSLT namespace
Constructor Summary
XSLTStylesheet()
Create a new XSLStylesheet
Method Summary
voidaddAttributeSet(AttributeSet attributeSet)
Adds the given AttributeSet to this stylesheet
voidaddId(String idAttr)
Adds a new Id to the list of IDs for this stylesheet for all elements.
voidaddId(String idAttr, String elementType)
Adds a new Id for the specified element type to the list of IDs for this element type stylesheet.
voidaddId(Id id)
Adds a new Id for the specified element type to the list of IDs for this element type stylesheet.
voidaddParam(Param param)
Adds a new top-level parameter to this stylesheet.
voidaddScript(XSLScript script)
Adds a new global level XSLScript to this stylesheet.
voidaddTemplate(TemplateRule template)
Adds a new TemplateRule to the list of rules for this stylesheet.
voidaddVariable(Variable variable)
Adds a new top-level Variable to this stylesheet
booleanappendAction(XSLObject xslObject)
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
 
intcountTemplates()
AttributeSetgetAttributeSet(String setName)
HashtablegetAttributeSets()
Returns all of the attribute-sets for this stylesheet
StringgetDocumentBase()
Returns the document base for this stylesheet
ListgetExtensionElementPrefixes()
Returns an enumeration of the declared namespace prefixes for extension elements
StringgetHref()
HashtablegetIds()
ListgetLocalTemplates()
TemplateRulegetNamedTemplate(String name)
Returns the TemplateRule whose name matches the given name argument.
EnumerationgetNamedTemplates()
Returns an enumeration of templates that have names
XSLOutputgetOutput()
Returns the XSLOutput Object for controlling the serialization of Result Documents created using this Stylesheet
ParamgetParameter(String name)
Returns the top-level parameter associated with the given name
EnumerationgetParameters()
Returns an Enumeration of the top-level parameters
StringgetQuotedNamespace(String namespace)
Returns the namespace that the given namespace argument quotes
StringgetResultDocType()
StringgetResultNamespace()
ListgetScripts()
Retrieves the set of global level scripts for this stylesheet
TemplateRule[]getTemplates()
URILocationgetURILocation()
Returns the URILocation for this stylesheet, or null, if no location was set.
VariablegetVariable(String name)
Returns the variable associated with the given name
EnumerationgetVariables()
Returns an Enumeration of the top-level variables
StringgetXSLNSPrefix()
Returns the XSL Namespace Prefix for this XSL Stylesheet
voidimportFrom(XSLTStylesheet xsl)
Imports the given XSLStylesheet to this XSLStylesheet.
voidimportFrom(XSLImport xslImport)
Imports the XSLStylesheet referenced by the given XSLImport to this stylesheet.
voidincludeFrom(XSLTStylesheet xsl)
Includes the given XSLStylesheet to this XSLStylesheet.
booleanisAllowableImport(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.
booleanisStripSpaceAllowed(String name)
Determines whether or not whitespace stripping is allowed for Elements with the given name
voidpreserveSpace(String name)
Preserves the whitespace of Elements with the given name.
voidsetAttribute(String name, String value)
voidsetURILocation(URILocation location)
Sets the URILocation for this stylesheet
voidstripSpace(String name)
Removes the ignorable whitespace from Elements with the given name.

Field Detail

XSLT_NAMESPACE

public static final String XSLT_NAMESPACE
The current (and ever changing) XSLT namespace

Constructor Detail

XSLTStylesheet

public XSLTStylesheet()
Create a new XSLStylesheet

Method Detail

addAttributeSet

public void addAttributeSet(AttributeSet attributeSet)
Adds the given AttributeSet to this stylesheet

Parameters: attributeSet the AttributeSet to add

addId

public void addId(String idAttr)
Adds a new Id to the list of IDs for this stylesheet for all elements.

Parameters: idAttr the id attribute to add

addId

public void addId(String idAttr, String elementType)
Adds a new Id for the specified element type to the list of IDs for this element type stylesheet.

Parameters: idAttr the ID to add elementType the tag name of the element that id is an ID for Note: the wild card "*" will match all element types

addId

public void addId(Id id)
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

public void addParam(Param param)
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

addScript

public void addScript(XSLScript script)
Adds a new global level XSLScript to this stylesheet.
Note: This is currently a proprietary feature

Parameters: script the XSLScript to add

addTemplate

public void addTemplate(TemplateRule template)
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

addVariable

public void addVariable(Variable variable)
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.

appendAction

public boolean appendAction(XSLObject xslObject)
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
 

countTemplates

public int countTemplates()

Returns: the number of templates contained in this stylesheet, including imported rules

getAttributeSet

public AttributeSet getAttributeSet(String setName)

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

public Hashtable getAttributeSets()
Returns all of the attribute-sets for this stylesheet

Returns: all of the AttributeSets for this stylesheet

getDocumentBase

public String getDocumentBase()
Returns the document base for this stylesheet

Returns: the document base for this stylesheet

getExtensionElementPrefixes

public List getExtensionElementPrefixes()
Returns an enumeration of the declared namespace prefixes for extension elements

getHref

public String getHref()

Returns: the href for this stylesheet

getIds

public Hashtable getIds()

Returns: a Vector of all the ID attributes for this Stylesheet

getLocalTemplates

public List getLocalTemplates()

Returns: a Vector of the TemplateRule objects for this stylesheet, does not include imported TemplateRules.

getNamedTemplate

public TemplateRule getNamedTemplate(String name)
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

public Enumeration getNamedTemplates()
Returns an enumeration of templates that have names

Returns: an enumeration of templates that have names

getOutput

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

getParameter

public Param getParameter(String name)
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

public Enumeration getParameters()
Returns an Enumeration of the top-level parameters

Returns: the Enumeration of top-level parameter declarations

getQuotedNamespace

public String getQuotedNamespace(String namespace)
Returns the namespace that the given namespace argument quotes

Parameters: namespace the namespace to resolve

UNKNOWN: the resolved namespace or the given namespace if it does not quote any other namespaces.

getResultDocType

public String getResultDocType()

getResultNamespace

public String getResultNamespace()

getScripts

public List getScripts()
Retrieves the set of global level scripts for this stylesheet

Returns: a List of XSLScript Objects

getTemplates

public TemplateRule[] getTemplates()

Returns: an array of all the TemplateRule objects for this stylesheet, including imported templates

getURILocation

public URILocation getURILocation()
Returns the URILocation for this stylesheet, or null, if no location was set.

Returns: the URILocation for this stylesheet

See Also: getHref getDocumentBase

getVariable

public Variable getVariable(String name)
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

public Enumeration getVariables()
Returns an Enumeration of the top-level variables

Returns: the Enumeration of top-level variable declarations

getXSLNSPrefix

public String getXSLNSPrefix()
Returns the XSL Namespace Prefix for this XSL Stylesheet

Returns: the XSL Namespace Prefix for this XSL Stylesheet

importFrom

public void importFrom(XSLTStylesheet xsl)
Imports the given XSLStylesheet to this XSLStylesheet.

Parameters: xsl the XSLStylesheet to import

Throws: XSLException

importFrom

public void importFrom(XSLImport xslImport)
Imports the XSLStylesheet referenced by the given XSLImport to this stylesheet.

Parameters: xslImport the XSLImport referencing the appropriate XSLStylesheet to import.

Throws: XSLException

includeFrom

public void includeFrom(XSLTStylesheet xsl)
Includes the given XSLStylesheet to this XSLStylesheet.

Parameters: xsl the XSLStylesheet to include

Throws: XSLException

See Also: isAllowableInclusion

isAllowableImport

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

Returns: true if the given filename is allowed to be included in this XSLStylesheet, otherwise false.

isStripSpaceAllowed

public boolean isStripSpaceAllowed(String name)
Determines whether or not whitespace stripping is allowed for Elements with the given name

Parameters: name the name of the Element

See Also: preserveSpace stripSpace

preserveSpace

public void preserveSpace(String name)
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: stripSpace

setAttribute

public void setAttribute(String name, String value)

See Also: org.exolab.adaptx.xslt.XSLElement

setURILocation

public void setURILocation(URILocation location)
Sets the URILocation for this stylesheet

Parameters: location the URILocation of this stylesheet

stripSpace

public void stripSpace(String name)
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: preserveSpace