You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by gl...@apache.org on 2001/05/23 13:28:56 UTC
cvs commit: jakarta-taglibs/src/taglib taglib-doc.xsl
glenn 01/05/23 04:28:56
Modified: src/taglib taglib-doc.xsl
Log:
Add support for documenting bean/script variable properties
Revision Changes Path
1.2 +298 -256 jakarta-taglibs/src/taglib/taglib-doc.xsl
Index: taglib-doc.xsl
===================================================================
RCS file: /home/cvs/jakarta-taglibs/src/taglib/taglib-doc.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- taglib-doc.xsl 2001/05/23 02:14:27 1.1
+++ taglib-doc.xsl 2001/05/23 11:28:55 1.2
@@ -1,256 +1,298 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0">
- <xsl:output method="html"
- indent="yes"
- omit-xml-declaration="yes"/>
- <!--
- This XSL is used to transform Tag library Documentation XML files into HTML
- documents formatted for the Jakarta Taglibs Web site.
-
- The Tag Library Documentation file(s) are standalone XML documents based on
- the Tag Library Descriptor format (i.e., they have no DTD or DOCTYPE
- declaration).
-
- The TLD forms the basis for the Documentation, much of it used here as the
- a natural base for the HTML documentation. Added to it are arbitrary, but
- conventional (the conventions determined by the Jakarta Taglibs project
- for the time being), XML elements used to provide information extraneous to
- the TLD proper. For example, info elements are added for tag attributes
- (a request has been made to the JSP expert group to add such an element to
- the TLD proper), and example elements are added for usage examples.
-
- Scott Stirling
- sstirling@mediaone.net
- 1/1/2001
- -->
-
-<!-- A footer linked in, which we call below (near the bottom) -->
-<xsl:include href="footer.xsl"/>
-
-<!--
- How some of the non-obvious TLD==>HTML mappings are used here:
-
- HTML <title> : TLD <taglib><info></info></taglib>
- HTML page title <h1>: TLD <taglib><info></info></taglib>
-
- - Sometimes the <shortname> value of the TLD is used as the taglib name or
- the prefix for various minutiae, other times the <info> line is used.
- Depends on the context, as you can see below.
- -->
-
-<xsl:template match="/">
- <xsl:apply-templates />
-</xsl:template>
-
-<xsl:template match="/document">
-<html>
- <xsl:apply-templates />
-</html>
-</xsl:template>
-
-<xsl:template match="/document/properties">
- <head>
- <meta content="{author}" name="author"/>
- <title><xsl:value-of select="title"/></title>
- <!-- link to the CSS used for HTML formatting -->
- <link rel="stylesheet" href="taglib.css" type="text/css" />
- </head>
-</xsl:template>
-
-<xsl:template match="/document/taglib">
- <body>
- <h1>Jakarta Project: <xsl:value-of select="//taglib/info"/></h1>
- <h3 class="middle">Version: <xsl:value-of select="//taglib/tlibversion"/></h3>
- <!-- Table of Contents -->
- <h3>Table of Contents</h3>
- <a href="#overview">Overview</a><br />
- <a href="#requirements">Requirements</a><br />
- <a href="#config">Configuration</a><br />
- <a href="#summary">Tag Summary</a><br />
- <a href="#reference">Tag Reference</a><br />
- <a href="#examples">Examples</a><br />
- <a href="#javadocs">Javadocs</a><br />
- <a href="#history">Revision History</a><br />
-
- <!-- Overview -->
- <a><xsl:attribute name="name">overview</xsl:attribute></a>
- <h3>Overview</h3>
- <xsl:for-each select="overview/*">
- <xsl:copy-of select="."/>
- </xsl:for-each>
-
- <!-- Requirements -->
- <a><xsl:attribute name="name">requirements</xsl:attribute></a>
- <h3>Requirements</h3>
- <xsl:apply-templates select="requirements-info"/>
-
- <!-- Configuration -->
- <a><xsl:attribute name="name">config</xsl:attribute></a>
- <h3>Configuration</h3>
- <p>Follow these steps to configure your web application with this tag library:</p>
- <ul>
- <li>Copy the tag library descriptor file to the /WEB-INF subdirectory
- of your web application.</li>
- <li>Copy the tag library JAR file to the /WEB-INF/lib subdirectory
- of your web application.</li>
- <li>Add a <taglib> element to your web application deployment
- descriptor in /WEB-INF/web.xml like this:
-<pre>
-<taglib>
- <taglib-uri>http://jakarta.apache.org/taglibs/<xsl:value-of select="shortname"/>-<xsl:value-of select="tlibversion"/></taglib-uri>
- <taglib-location><xsl:value-of select="taglib-location"/></taglib-location>
-</taglib>
-</pre>
- </li>
- </ul>
- <p>To use the tags from this library in your JSP pages, add the following
- directive at the top of each page: </p>
-<pre>
-<%@ taglib uri="http://jakarta.apache.org/taglibs/<xsl:value-of select="shortname"/>-<xsl:value-of select="tlibversion"/>" prefix="<xsl:value-of select="prefix"/>" %>
-</pre>
- <p>where "<i><xsl:value-of select="prefix"/></i>" is the tag name prefix you wish to use for tags
- from this library. You can change this value to any prefix you like.</p>
-
- <!-- Tag Summary Section -->
- <a><xsl:attribute name="name">summary</xsl:attribute></a>
- <h3>Tag Summary</h3>
- <table summary="summary list of tags with short description of each.">
- <xsl:for-each select="tag">
- <tr>
- <td>
- <a>
- <xsl:attribute name="href">#<xsl:value-of select="name"/></xsl:attribute><xsl:value-of select="name"/>
- </a>
- </td>
- <td><xsl:value-of select="info"/></td>
- </tr>
- </xsl:for-each>
- <!-- The next empty row is for formatting purposes only. -->
- <tr>
- <td colspan="2"><xsl:text> </xsl:text></td>
- </tr>
- </table>
-
- <!-- Tag Reference Section -->
- <a><xsl:attribute name="name">reference</xsl:attribute></a>
- <h3>Tag Reference</h3>
- <!-- Start for-each to process <tag> elements here -->
- <xsl:for-each select="tag">
- <table border="0" width="90%" cellpadding="3" cellspacing="0" summary="This table is for visual formatting of tag reference information.">
- <tr>
- <td colspan="2">
- <table border="0" bgcolor="#cccccc" width="100%" cellspacing="0" summary="name and tag library version availability of tag.">
- <tr>
- <td><b><font size="+1"><a><xsl:attribute name="name"><xsl:value-of select="name"/></xsl:attribute><xsl:value-of select="name"/></a></font></b></td>
- <td align="right">Availability: version <xsl:value-of select="//taglib/tlibversion"/></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan="2"><xsl:value-of select="info"/></td>
- </tr>
- <tr>
- <td width="2%"><xsl:text> </xsl:text></td>
- <td width="98%">
- <table border="0" width="100%" summary="Tag class, tag name, script variable (if any), and restrictions (if any).">
- <tr>
- <td width="20%"><span class="tclass">Tag Class</span></td>
- <td width="80%"><xsl:value-of select="tagclass"/></td>
- </tr>
- <tr>
- <td width="20%"><span class="tbody">Tag Body</span></td>
- <td width="80%"><xsl:value-of select="bodycontent"/></td>
- </tr>
- <tr>
- <td width="20%"><span class="scriptvar">Script Variable</span></td>
- <td width="80%"><xsl:value-of select="script-variable"/></td>
- </tr>
- <tr>
- <td width="20%"><span class="restrictions">Restrictions</span></td>
- <td width="80%"><xsl:value-of select="restrictions"/></td>
- </tr>
- <!-- BEGIN xsl:choose
- If tag has attributes, then create headers and iterate over the
- attributes, otherwise, skip headers and print "None" -->
- <xsl:choose>
- <xsl:when test="attribute">
- <tr>
- <td width="20%"><span class="attributes">Attributes</span></td>
- <td width="80%"><xsl:text> </xsl:text></td>
- </tr>
- <tr>
- <td width="20%"><xsl:text> </xsl:text></td>
- <td width="80%">
- <table border="0" width="100%" summary="Tag attribute name, whether required, and whether rtexprvalue allowed.">
- <tr>
- <td width="40%">Name</td>
- <td width="20%">Required</td>
- <td width="40%">Runtime Expression Evaluation</td>
- </tr>
-
- <!-- Start <attribute> for-each here -->
- <xsl:for-each select="attribute">
- <tr bgcolor="#cccccc">
- <td width="40%"><b><xsl:value-of select="name"/></b></td>
- <td width="20%"><xsl:value-of select="required"/></td>
- <td width="40%"><xsl:value-of select="rtexprvalue"/></td>
- </tr>
- <tr>
- <td colspan="3"><xsl:value-of select="info"/></td>
- </tr>
- </xsl:for-each>
- <!-- End <attribute> for-each here -->
- </table>
- </td>
- </tr>
- </xsl:when>
- <xsl:otherwise>
- <tr>
- <td width="20%"><span class="attributes">Attributes</span></td>
- <td width="80%">None</td>
- </tr>
- </xsl:otherwise>
- </xsl:choose>
- <!-- END xsl:choose -->
- <tr>
- <td width="20%" valign="top"><span class="example">Example</span></td>
- <td width="80%">
- <!-- Examples Section -->
- <ol><xsl:for-each select="usage">
- <li><xsl:if test="comment">
- <span class="comment"><%--<xsl:value-of select="comment"/>--%></span><br /></xsl:if>
- <xsl:for-each select="scriptlet"><span class="jsp-squig"><%</span><span class="scriptlet"> <xsl:value-of select="."/> </span><span class="jsp-squig">%></span><br />
- </xsl:for-each>
- <!-- A little trick here: the XML element <code> in our TLDoc matches
- the HTML element <code> on purpose so that we can just copy the
- whole node, including the opening and closing <code> tags.
- -->
- <p><pre>
-<xsl:copy-of select="code"/></pre></p></li>
- </xsl:for-each>
- </ol>
- <!-- End Examples Section -->
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <!-- End for-each <tag> element here -->
- </xsl:for-each>
-
- <!-- Footer Section (Examples, Javadoc, History) called. -->
- <xsl:call-template name="footer"/>
- </body>
-</xsl:template>
-
-<xsl:template match="requirements-info">
- <p>
- <xsl:copy-of select="*|text()"/>
- </p>
-</xsl:template>
-
-</xsl:stylesheet>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+ <xsl:output method="html"
+ indent="yes"
+ omit-xml-declaration="yes"/>
+ <!--
+ This XSL is used to transform Tag library Documentation XML files into
+ HTML documents formatted for the Jakarta Taglibs Web site.
+
+ The Tag Library Documentation file(s) are standalone XML documents based
+ on the Tag Library Descriptor format (i.e., they have no DTD or DOCTYPE
+ declaration).
+
+ The TLD forms the basis for the Documentation, much of it used here as the
+ a natural base for the HTML documentation. Added to it are arbitrary, but
+ conventional (the conventions determined by the Jakarta Taglibs project
+ for the time being), XML elements used to provide information extraneous to
+ the TLD proper. For example, info elements are added for tag attributes
+ (a request has been made to the JSP expert group to add such an element to
+ the TLD proper), and example elements are added for usage examples.
+
+ Scott Stirling
+ sstirling@mediaone.net
+ 1/1/2001
+ -->
+
+<!-- A footer linked in, which we call below (near the bottom) -->
+<xsl:include href="footer.xsl"/>
+
+<!--
+ How some of the non-obvious TLD==>HTML mappings are used here:
+
+ HTML <title> : TLD <taglib><info></info></taglib>
+ HTML page title <h1>: TLD <taglib><info></info></taglib>
+
+ - Sometimes the <shortname> value of the TLD is used as the taglib name or
+ the prefix for various minutiae, other times the <info> line is used.
+ Depends on the context, as you can see below.
+ -->
+
+<xsl:template match="/">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/document">
+<html>
+ <xsl:apply-templates />
+</html>
+</xsl:template>
+
+<xsl:template match="/document/properties">
+ <head>
+ <meta content="{author}" name="author"/>
+ <title><xsl:value-of select="title"/></title>
+ <!-- link to the CSS used for HTML formatting -->
+ <link rel="stylesheet" href="taglib.css" type="text/css" />
+ </head>
+</xsl:template>
+
+<xsl:template match="/document/taglib">
+ <body>
+ <h1>Jakarta Project: <xsl:value-of select="//taglib/info"/></h1>
+ <h3 class="middle">Version: <xsl:value-of select="//taglib/tlibversion"/></h3>
+ <!-- Table of Contents -->
+ <h3>Table of Contents</h3>
+ <a href="#overview">Overview</a><br />
+ <a href="#requirements">Requirements</a><br />
+ <a href="#config">Configuration</a><br />
+ <a href="#summary">Tag Summary</a><br />
+ <a href="#reference">Tag Reference</a><br />
+ <a href="#examples">Examples</a><br />
+ <a href="#javadocs">Javadocs</a><br />
+ <a href="#history">Revision History</a><br />
+
+ <!-- Overview -->
+ <a><xsl:attribute name="name">overview</xsl:attribute></a>
+ <h3>Overview</h3>
+ <xsl:for-each select="overview/*">
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+
+ <!-- Requirements -->
+ <a><xsl:attribute name="name">requirements</xsl:attribute></a>
+ <h3>Requirements</h3>
+ <xsl:apply-templates select="requirements-info"/>
+
+ <!-- Configuration -->
+ <a><xsl:attribute name="name">config</xsl:attribute></a>
+ <h3>Configuration</h3>
+ <p>Follow these steps to configure your web application with this tag library:</p>
+ <ul>
+ <li>Copy the tag library descriptor file to the /WEB-INF subdirectory
+ of your web application.</li>
+ <li>Copy the tag library JAR file to the /WEB-INF/lib subdirectory
+ of your web application.</li>
+ <li>Add a <taglib> element to your web application deployment
+ descriptor in /WEB-INF/web.xml like this:
+<pre>
+<taglib>
+ <taglib-uri>http://jakarta.apache.org/taglibs/<xsl:value-of select="shortname"/>-<xsl:value-of select="tlibversion"/></taglib-uri>
+ <taglib-location><xsl:value-of select="taglib-location"/></taglib-location>
+</taglib>
+</pre>
+ </li>
+ </ul>
+ <p>To use the tags from this library in your JSP pages, add the following
+ directive at the top of each page: </p>
+<pre>
+<%@ taglib uri="http://jakarta.apache.org/taglibs/<xsl:value-of select="shortname"/>-<xsl:value-of select="tlibversion"/>" prefix="<xsl:value-of select="prefix"/>" %>
+</pre>
+ <p>where "<i><xsl:value-of select="prefix"/></i>" is the tag name prefix you wish to use for tags
+ from this library. You can change this value to any prefix you like.</p>
+
+ <!-- Tag Summary Section -->
+ <a><xsl:attribute name="name">summary</xsl:attribute></a>
+ <h3>Tag Summary</h3>
+ <table summary="summary list of tags with short description of each.">
+ <xsl:for-each select="tag">
+ <tr>
+ <td>
+ <a>
+ <xsl:attribute name="href">#<xsl:value-of select="name"/></xsl:attribute><xsl:value-of select="name"/>
+ </a>
+ </td>
+ <td><xsl:value-of select="info"/></td>
+ </tr>
+ </xsl:for-each>
+ <!-- The next empty row is for formatting purposes only. -->
+ <tr>
+ <td colspan="2"><xsl:text> </xsl:text></td>
+ </tr>
+ </table>
+
+ <!-- Tag Reference Section -->
+ <a><xsl:attribute name="name">reference</xsl:attribute></a>
+ <h3>Tag Reference</h3>
+ <!-- Start for-each to process <tag> elements here -->
+ <xsl:for-each select="tag">
+ <table border="0" width="90%" cellpadding="3" cellspacing="0" summary="This table is for visual formatting of tag reference information.">
+ <tr>
+ <td colspan="2">
+ <table border="0" bgcolor="#cccccc" width="100%" cellspacing="0" summary="name and tag library version availability of tag.">
+ <tr>
+ <td><b><font size="+1"><a><xsl:attribute name="name"><xsl:value-of select="name"/></xsl:attribute><xsl:value-of select="name"/></a></font></b></td>
+ <td align="right">Availability: version <xsl:value-of select="//taglib/tlibversion"/></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2"><xsl:value-of select="info"/></td>
+ </tr>
+ <tr>
+ <td width="2%"><xsl:text> </xsl:text></td>
+ <td width="98%">
+ <table border="0" width="100%" summary="Tag name, script variable (if any), and restrictions (if any).">
+ <tr>
+ <td width="20%"><span class="tbody">Tag Body</span></td>
+ <td width="80%"><xsl:value-of select="bodycontent"/></td>
+ </tr>
+ <tr>
+ <td width="20%"><span class="scriptvar">Script Variable</span></td>
+ <td width="80%"><xsl:value-of select="script-variable"/></td>
+ </tr>
+ <tr>
+ <td width="20%"><span class="restrictions">Restrictions</span></td>
+ <td width="80%"><xsl:value-of select="restrictions"/></td>
+ </tr>
+ <!-- BEGIN xsl:choose
+ If tag has attributes, then create headers and iterate over the
+ attributes, otherwise, skip headers and print "None" -->
+ <xsl:choose>
+ <xsl:when test="attribute">
+ <tr>
+ <td width="20%"><span class="attributes">Attributes</span></td>
+ <td width="80%"><xsl:text> </xsl:text></td>
+ </tr>
+ <tr>
+ <td width="20%"><xsl:text> </xsl:text></td>
+ <td width="80%">
+ <table border="0" width="100%" summary="Tag attribute name, whether required, and whether rtexprvalue allowed.">
+ <tr>
+ <td width="40%">Name</td>
+ <td width="20%">Required</td>
+ <td width="40%">Runtime Expression Evaluation</td>
+ </tr>
+
+ <!-- Start <attribute> for-each here -->
+ <xsl:for-each select="attribute">
+ <tr bgcolor="#cccccc">
+ <td width="40%"><b><xsl:value-of select="name"/></b></td>
+ <td width="20%"><xsl:value-of select="required"/></td>
+ <td width="40%"><xsl:value-of select="rtexprvalue"/></td>
+ </tr>
+ <tr>
+ <td colspan="3"><xsl:value-of select="info"/></td>
+ </tr>
+ </xsl:for-each>
+ <!-- End <attribute> for-each here -->
+ </table>
+ </td>
+ </tr>
+ </xsl:when>
+ <xsl:otherwise>
+ <tr>
+ <td width="20%"><span class="attributes">Attributes</span></td>
+ <td width="80%">None</td>
+ </tr>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- END xsl:choose -->
+
+ <!-- BEGIN xsl:choose
+ If tag creates a script variable or attribute with properties,
+ then create headers and iterate over the properties,
+ otherwise, skip headers and print "None" -->
+ <xsl:choose>
+ <xsl:when test="beanprop">
+ <tr>
+ <td width="20%"><span class="attributes">Properties</span></td>
+ <td width="80%"><xsl:text> </xsl:text></td>
+ </tr>
+ <tr>
+ <td width="20%"><xsl:text> </xsl:text></td>
+ <td width="80%">
+ <table border="0" width="100%" summary="Property name, supports set, supports get.">
+ <tr>
+ <td width="60%">Name</td>
+ <td width="20%">Get</td>
+ <td width="20%">Set</td>
+ </tr>
+
+ <!-- Start <beanprop> for-each here -->
+ <xsl:for-each select="beanprop">
+ <tr bgcolor="#cccccc">
+ <td width="40%"><b><xsl:value-of select="name"/></b></td>
+ <td width="20%"><xsl:value-of select="get"/></td>
+ <td width="40%"><xsl:value-of select="set"/></td>
+ </tr>
+ <tr>
+ <td colspan="3"><xsl:value-of select="info"/></td>
+ </tr>
+ </xsl:for-each>
+ <!-- End <beanprop> for-each here -->
+ </table>
+ </td>
+ </tr>
+ </xsl:when>
+ <xsl:otherwise>
+ <tr>
+ <td width="20%"><span class="attributes">Properties</span></td>
+ <td width="80%">None</td>
+ </tr>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- END xsl:choose -->
+
+ <tr>
+ <td width="20%" valign="top"><span class="example">Example</span></td>
+ <td width="80%">
+ <!-- Examples Section -->
+ <ol><xsl:for-each select="usage">
+ <li><xsl:if test="comment">
+ <span class="comment"><%--<xsl:value-of select="comment"/>--%></span><br /></xsl:if>
+ <xsl:for-each select="scriptlet"><span class="jsp-squig"><%</span><span class="scriptlet"> <xsl:value-of select="."/> </span><span class="jsp-squig">%></span><br />
+ </xsl:for-each>
+ <!-- A little trick here: the XML element <code> in our TLDoc matches
+ the HTML element <code> on purpose so that we can just copy the
+ whole node, including the opening and closing <code> tags.
+ -->
+ <p><pre>
+<xsl:copy-of select="code"/></pre></p></li>
+ </xsl:for-each>
+ </ol>
+ <!-- End Examples Section -->
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <!-- End for-each <tag> element here -->
+ </xsl:for-each>
+
+ <!-- Footer Section (Examples, Javadoc, History) called. -->
+ <xsl:call-template name="footer"/>
+ </body>
+</xsl:template>
+
+<xsl:template match="requirements-info">
+ <p>
+ <xsl:copy-of select="*|text()"/>
+ </p>
+</xsl:template>
+
+</xsl:stylesheet>