XSL taglib ver. 2.2


    Custom JSP tags. Lets you apply the given XSL stylesheet to the given XML data and rendering the output to your JSP page. You may set an XML data as
- a some string with XML data or
- an URL (or file name) points to XML data or
- a body for setXML tag

and XSL data you may set as
- a some string with XSL stylesheet or
- an URL (or file name) points to XSL stylesheet
- a body for setXSL tag

For example:
 


<%@ taglib uri="taglib.tld" prefix="xslt" %>
<html>

<!-- use two files: XML data and XSL styleshhet -->
<xslt:applyXSL xmlData="data.xml" xslData="sheet.xsl"/>

<!-- use XSL stylesheet and XML body -->
<xslt:applyXSL xslData="sheet.xsl">
  <xslt:setXML>
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <users>
    <user> <id>123</id> <name>John</name></user>
    <user> <id>456</id> <name>Steve</name></user>
    </users>
  </xslt:setXML>
</xslt:applyXSL>

<!-- use XML string and XSL stylesheet with parameter -->
<%
    String s;

    // accumulate XML data
    s="your XML data";
%>
<xslt:applyXSL xmlString="<%=s%>" xslData="sheet.xsl">
  <xslt:setParameter name="myParam"> value for param </xslt:setParameter>
</xslt:applyXSL>

</html>

Tags are:

applyXSL

Body tag lets you apply the given XSL stylesheet to the given XML data and rendering the output to your JSP page. Parameters are:

1) xmlString Describes a string with XML data (see setXML tag also)
2) xslString Describes a string with XSL data (see setXSL tag also)
3) xmlData URL or file with XML data
4) xslData URL or file with XSL data
5) xmlCacheScope Optional parameter. You may cache xmlData per users (session scope) or globally (application scope). So possible values are session or application. Cache will be updated according to date of modification for your XML file.
6) xslCacheScope Optional parameter. You may cache xslData per users (session scope) or globally (application scope). So possible values are session or application. Cache will be updated according to date of modification for your XSL file.
7) id Optional parameter. Describes a name for page scope variable for output (type is java.lang.String). Without this parameter tag just prints data.
8) ignoreDTD Optional parameter. Possible values are true or false. Lets you ignore external DTD during the parsing. Default value is false.
9) systemId Optional parameter. Describes a name systemId for your XSL data. Must be a String that conforms to the URI syntax.

setXML

Body tag lets you set XML data. You can use this tag inside of applyXSL. Parameters are: none

setXSL

Body tag lets you set XSL data. You can use this tag inside of applyXSL. Parameters are:

1) systemId Optional parameter. Describes a name systemId for your XSL data. Must be a String that conforms to the URI syntax.

setParameter

Body tag lets you set a parameter for XSL stylesheet. Tag's body describes a value for parameter. You can use this tag inside of applyXSL. Parameters are:

1) name Describes a name for your parameter
2) cond Optional attribute. Describes a boolean value tag's behavior depends on. Default value is true (set parameter)

Notes:

1. Taglib uses JAXP for parsing XML files .
 

for downloading:

    Library: xsltag.jar    Description: taglib.tld

 © Coldbeans Software      Comments?

 See also Coldtags suite - the largest collection of custom JSP tags.

Also in Coldtags: