A simple tag library for transforming XML input sources with XSL stylesheets
This tag library uses version 1 of both the Xerces XML parser and the Xalan XSLT processor. For production use we recommend you use the XTAGS tag library or the Standard tag library. Both of these use TRAX API compatible XSLT processors such as Xalan 2 and have more features.
This custom tag library requires a servlet container that supports the JavaServer Pages Specification, version 1.1.
This custom tag library also requires the Xerces 1 XML parser and the Xalan 1 XSLT processor.
Follow these steps to configure your web application with this tag library:
<taglib> <taglib-uri>http://jakarta.apache.org/taglibs/xsl-1.0</taglib-uri> <taglib-location>/WEB-INF/xsl.tld</taglib-location> </taglib>
To use the tags from this library in your JSP pages, add the following directive at the top of each page:
<%@ taglib uri="http://jakarta.apache.org/taglibs/xsl-1.0" prefix="xsl" %>
where "xsl" is the tag name prefix you wish to use for tags from this library. You can change this value to any prefix you like.
| apply | Apply an XSL transformation on an XML source |
| export | Export the content of a JSP Bean to the output. |
| import | Import the contents of the specified page and store it as a String in the specified bean and scope. |
| include | Include the contents of the specified page. |
| ShowSource | Convenience tag to show JSP Source. |
| apply | Availability: 1.0 | ||||
|
Apply the specified stylesheet to the specified XML input, both of which may be acquired in a variety of manners depending upon the optional attributes that are included. |
|||||
| Tag Body | JSP | ||||
| Restrictions |
Valid attribute combinations to select the XML data source are:
|
||||
| Attributes | Name | Required | Runtime Expression Evaluation | Availability | |
| nameXml | No | No | 1.0 | ||
|
Name of a bean (in any scope) that defines the source of the XML data to be transformed. This bean must be of one of the following Java classes:
|
|||||
| nameXsl | No | No | 1.0 | ||
|
Name of a bean (in any scope) that defines the source of the XSL stylesheet to be used. This bean must be of one of the following Java classes:
|
|||||
| propertyXml | No | No | 1.0 | ||
|
If specified, the bean identified by "nameXml" is assumed to have a property whose getter method is called to define the XML data source, instead of interpreting that bean itself. |
|||||
| propertyXsl | No | No | 1.0 | ||
|
If specified, the bean identified by "nameXsl" is assumed to have a property whose getter method is called to define the XSL stylesheet source, instead of interpreting that bean itself |
|||||
| xml | No | Yes | 1.0 | ||
|
If specified, the context-relative path to an application resource containing the XML data. |
|||||
| xsl | No | Yes | 1.0 | ||
|
If specified, the context-relative path to an application resource containing the XSL stylesheet. |
|||||
| Variables | None | ||||
| Examples | None | ||||
| export | Availability: 1.0 | ||||
|
Export the contents of the specified JSP bean in the specified scope to our output stream, presumably after its contents have been manipulated. |
|||||
| Tag Body | empty | ||||
| Restrictions |
None |
||||
| Attributes | Name | Required | Runtime Expression Evaluation | Availability | |
| name | Yes | No | 1.0 | ||
|
Name of a JSP bean whose content is to be rendered to our output stream. |
|||||
| scope | No | No | 1.0 | ||
|
Scope in which this bean is registered. If not specified, page scope is assumed. |
|||||
| Variables | None | ||||
| Examples | None | ||||
| import | Availability: 1.0 | ||||
|
Import the contents of the specified page, and store it as a String in the specified bean and scope. This tag is useful for assigning the content of XML data (or an XSL stylesheet) to a bean that can later be manipulated with the "apply" tag. |
|||||
| Tag Body | empty | ||||
| Restrictions |
None |
||||
| Attributes | Name | Required | Runtime Expression Evaluation | Availability | |
| id | Yes | No | 1.0 | ||
|
Name of a JSP bean to be created containing the contents of the specified page as a String. |
|||||
| page | Yes | Yes | 1.0 | ||
|
Context-relative URI of the page (or servlet) to be executed, and whose output should be imported |
|||||
| scope | No | No | 1.0 | ||
|
Scope in which the bean specified by "id" will be created (page, request, session, application). If not specified, page scope is assumed. |
|||||
| Variables | None | ||||
| Examples | None | ||||
| include | Availability: 1.0 | ||||
|
Include the contents of the specified page. This tag is similar to <jsp:include>, but causes the included contents to be rendered to our JspWriter (and thus to the body content of any enclosing tag) rather than being sent directly to the output stream. |
|||||
| Tag Body | empty | ||||
| Restrictions |
None |
||||
| Attributes | Name | Required | Runtime Expression Evaluation | Availability | |
| page | Yes | Yes | 1.0 | ||
|
Context-relative URI of the page (or servlet) to be executed, and whose output should be included at this point. |
|||||
| Variables | None | ||||
| Examples | None | ||||
| ShowSource | Availability: 1.0 | ||||
|
Convenience tag to show JSP Source. |
|||||
| Tag Body | empty | ||||
| Restrictions |
None |
||||
| Attributes | Name | Required | Runtime Expression Evaluation | Availability | |
| jspFile | Yes | Yes | 1.0 | ||
|
Web application context relative JSP file to show source for. |
|||||
| Variables | None | ||||
| Examples | None | ||||
See the example application xsl-examples.war for examples of the usage of the tags from this custom tag library.
Java programmers can view the java class documentation for this tag library as javadocs.
Review the complete revision history of this tag library.