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/06/25 15:26:10 UTC

cvs commit: jakarta-taglibs/src/taglib taglib-doc.xsl

glenn       01/06/25 06:26:10

  Modified:    src/taglib taglib-doc.xsl
  Log:
  Stylesheet updated for latest JSP1.2 PFD and new generated taglib documentation format
  
  Revision  Changes    Path
  1.3       +314 -191  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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- taglib-doc.xsl	2001/05/23 11:28:55	1.2
  +++ taglib-doc.xsl	2001/06/25 13:26:06	1.3
  @@ -53,246 +53,369 @@
   <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" /> 
  +    <xsl:choose>
  +      <xsl:when test="title">
  +        <title><xsl:value-of select="title"/></title>
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <title>
  +          Jakarta-Taglibs:
  +          <xsl:value-of select="/document/taglib/display-name"/>
  +        </title>
  +      </xsl:otherwise>
  +    </xsl:choose>
     </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>
  +  <body bgcolor="white">
  +  <center>
  +    <h1>Jakarta Project: <xsl:value-of select="display-name"/></h1>
  +    <h3>Version: <xsl:value-of select="tlibversion"/></h3>
  +  </center>
  +
  +  <!-- 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/>
  +  <!-- Additional TOC sections -->
  +  <xsl:for-each select="toc">
  +    <a>
  +      <xsl:attribute name="href">#<xsl:value-of select="@href"/>
  +      </xsl:attribute><xsl:value-of select="@name"/>
  +    </a><br/>
  +  </xsl:for-each>
  +  <!-- End Additional TOC sections -->
  +  <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="description/*">
  +    <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 &lt;taglib&gt; element to your web application deployment
  -                descriptor in /WEB-INF/web.xml like this:
  +  <!-- 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 &lt;taglib&gt; element to your web application deployment
  +        descriptor in /WEB-INF/web.xml like this:
   <pre>
   &lt;taglib&gt;
     &lt;taglib-uri&gt;http://jakarta.apache.org/taglibs/<xsl:value-of select="shortname"/>-<xsl:value-of select="tlibversion"/>&lt;/taglib-uri&gt;
     &lt;taglib-location&gt;<xsl:value-of select="taglib-location"/>&lt;/taglib-location&gt;
   &lt;/taglib&gt;
   </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>
  +    </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>
   &lt;%@ taglib uri=&quot;http://jakarta.apache.org/taglibs/<xsl:value-of select="shortname"/>-<xsl:value-of select="tlibversion"/>&quot; prefix=&quot;<xsl:value-of select="prefix"/>&quot; %&gt;
   </pre>
  -        <p>where &quot;<i><xsl:value-of select="prefix"/></i>&quot; 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>
  +  <p>where &quot;<i><xsl:value-of select="prefix"/></i>&quot; 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">
  +  <!--  Tag Summary Section  -->
  +  <a><xsl:attribute name="name">summary</xsl:attribute></a>
  +  <h3>Tag Summary</h3>
  +  <xsl:for-each select="tagtoc">
  +    <b><xsl:value-of select="@name"/></b>
  +    <table>
  +      <xsl:for-each select="tag">
           <tr>
             <td>
               <a>
  -              <xsl:attribute name="href">#<xsl:value-of select="name"/></xsl:attribute><xsl:value-of select="name"/>
  +              <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>
  +          </td>
  +          <td><xsl:value-of select="summary"/></td>
           </tr> 
  -        </xsl:for-each>
  -        <!-- The next empty row is for formatting purposes only. -->
  -        <tr>
  -          <td colspan="2"><xsl:text>&#160;</xsl:text></td>
  -        </tr>
  +      </xsl:for-each>
  +      <!-- The next empty row is for formatting purposes only. -->
  +      <tr>
  +        <td colspan="2"><xsl:text>&#160;</xsl:text></td>
  +      </tr>
       </table>
  +  </xsl:for-each>
   
  -    <!-- Tag Reference Section -->
  -    <a><xsl:attribute name="name">reference</xsl:attribute></a>
  -    <h3>Tag Reference</h3>
  +  <!-- Tag Reference Section -->
  +  <a><xsl:attribute name="name">reference</xsl:attribute></a>
  +  <h3>Tag Reference</h3>
  +  <xsl:for-each select="tagtoc">
       <!-- 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>&#160;</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>&#160;</xsl:text></td>
  -            </tr>
  -            <tr>
  -              <td width="20%"><xsl:text>&#160;</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>
  +      <table border="0" width="90%" cellpadding="3" cellspacing="3">
  +        <tr bgcolor="#cccccc">
  +          <td colspan="5" width="83%">
  +            <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: <xsl:value-of select="availability"/>
  +          </td>
  +        </tr>
  +        <tr>
  +          <td colspan="6"><xsl:copy-of select="description"/></td>
  +        </tr>
  +        <tr>
  +          <td><b>Tag Body</b></td>
  +          <td colspan="5"><xsl:value-of select="bodycontent"/></td>
  +        </tr>
  +        <tr>
  +          <td><b>Restrictions</b></td>
  +          <td colspan="5"><xsl:value-of select="restrictions"/></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>
  +        <!-- 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><b>Attributes</b></td>
  +              <td >Name</td>
  +              <td >Required</td>
  +              <td colspan="2">
  +                Runtime<xsl:text>&#160;</xsl:text>Expression<xsl:text>&#160;</xsl:text>Evaluation
                 </td>
  +              <td >Availability</td>
               </tr>
  -            </xsl:when>
  -            <xsl:otherwise>
  +    
  +            <!-- Start <attribute> for-each here -->
  +            <xsl:for-each select="attribute">
  +              <tr bgcolor="#cccccc">
  +                <td bgcolor="#ffffff"><xsl:text>&#160;</xsl:text></td>
  +                <td><b><xsl:value-of select="name"/></b></td>
  +                <td>
  +                   <xsl:text>&#160;</xsl:text>
  +                   <xsl:value-of select="required"/>
  +                </td>
  +                <td colspan="2">
  +                  <xsl:text>&#160;</xsl:text>
  +                  <xsl:value-of select="rtexprvalue"/>
  +                </td>
  +                <td>
  +                  <xsl:text>&#160;</xsl:text>
  +                  <xsl:value-of select="availability"/>
  +                </td>
  +              </tr>
  +              <tr>
  +                <td bgcolor="#ffffff"><xsl:text>&#160;</xsl:text></td>
  +                <td colspan="5">
  +                   <xsl:copy-of select="description"/>
  +                </td>
  +              </tr>
  +            </xsl:for-each>
  +            <!-- End <attribute> for-each here -->
  +          </xsl:when>
  +          <xsl:otherwise>
               <tr> 
  -              <td width="20%"><span class="attributes">Attributes</span></td>
  -              <td width="80%">None</td>
  +              <td><b>Attributes</b></td>
  +              <td colspan="5">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">
  +          </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="variable">
               <tr>
  -              <td width="20%"><span class="attributes">Properties</span></td>
  -              <td width="80%"><xsl:text>&#160;</xsl:text></td>
  +              <td><b>Variables</b></td>
  +              <td colspan="2">Name</td>
  +              <td colspan="2">Scope</td>
  +              <td>Availability</td>
               </tr>
  -            <tr>
  -              <td width="20%"><xsl:text>&#160;</xsl:text></td>
  -              <td width="80%">
  -                <table border="0" width="100%" summary="Property name, supports set, supports get.">
  +            <xsl:for-each select="variable">
  +              <tr bgcolor="#cccccc">
  +                <td bgcolor="#ffffff"><xsl:text>&#160;</xsl:text></td>
  +                <xsl:choose>
  +                  <xsl:when test="name-given">
  +                    <td colspan="2">
  +                      <xsl:text>&#160;</xsl:text>
  +                      <b><xsl:value-of select="name-given"/></b>
  +                    </td>
  +		  </xsl:when>
  +		  <xsl:otherwise>
  +                    <td colspan="2"><xsl:text>&#160;</xsl:text>
  +                      <b><xsl:value-of select="name-from-attribute"/></b>
  +                      attribute value
  +                    </td>
  +                  </xsl:otherwise>
  +                </xsl:choose>
  +                <td colspan="2">
  +                  <xsl:text>&#160;</xsl:text>
  +                  <xsl:choose>
  +                    <xsl:when test="scope='AT_BEGIN'">
  +                      Start of tag to end of page
  +                    </xsl:when>
  +                    <xsl:when test="scope='AT_END'">
  +                      End of tag to end of page
  +                    </xsl:when>
  +                    <xsl:otherwise>
  +                      Nested within tag
  +                    </xsl:otherwise>
  +                  </xsl:choose>
  +                </td>
  +                <td>
  +                  <xsl:text>&#160;</xsl:text>
  +                  <xsl:value-of select="availability"/>
  +                </td>
  +              </tr>
  +              <tr>
  +                <td><xsl:text>&#160;</xsl:text></td>
  +                <td colspan="5">
  +                  <xsl:value-of select="description"/>
  +                </td>
  +              </tr>
  +              <xsl:choose>
  +                <xsl:when test="beanprop">
                     <tr>
  -                    <td width="60%">Name</td>
  -                    <td width="20%">Get</td>
  -                    <td width="20%">Set</td>
  +                    <td><xsl:text>&#160;</xsl:text></td>
  +                    <td ><b>Properties</b></td>
  +                    <td >Name</td>
  +                    <td >Get</td>
  +                    <td >Set</td>
  +                    <td >Availability</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>
  +                    <tr bgcolor="#cccccc">
  +                      <td bgcolor="#ffffff"><xsl:text>&#160;</xsl:text></td>
  +                      <td bgcolor="#ffffff"><xsl:text>&#160;</xsl:text></td>
  +                      <td>
  +                        <xsl:text>&#160;</xsl:text>
  +                        <b><xsl:value-of select="name"/></b>
  +                      </td>
  +                      <td><xsl:text>&#160;</xsl:text>
  +                        <xsl:value-of select="get"/>
  +                      </td>
  +                      <td><xsl:text>&#160;</xsl:text>
  +                        <xsl:value-of select="set"/>
  +                      </td>
  +                      <td><xsl:text>&#160;</xsl:text>
  +                        <xsl:value-of select="availability"/>
  +                      </td>
  +                    </tr>
  +                    <tr> 
  +                      <td><xsl:text>&#160;</xsl:text></td>
  +                      <td><xsl:text>&#160;</xsl:text></td>
  +                      <td colspan="4">
  +                        <xsl:copy-of select="description"/>
  +                      </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>
  +                </xsl:when>
  +                <xsl:otherwise>
  +                  <tr>
  +                    <td><xsl:text>&#160;</xsl:text></td>
  +                    <td><b>Properties</b></td>
  +                    <td colspan="4">None</td>
  +                  </tr>
  +                </xsl:otherwise>
  +              </xsl:choose>
  +            </xsl:for-each>
  +          </xsl:when>
  +          <xsl:otherwise>
  +            <tr>         
  +              <td><b>Variables</b></td>
  +              <td colspan="5">None</td>
               </tr>
  -            </xsl:otherwise>
  -            </xsl:choose>
  -            <!-- END xsl:choose -->
  +          </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">&lt;%--<xsl:value-of select="comment"/>--%&gt;</span><br /></xsl:if> 
  -            <xsl:for-each select="scriptlet"><span class="jsp-squig">&lt;%</span><span class="scriptlet"> <xsl:value-of select="."/> </span><span class="jsp-squig">%&gt;</span><br /> 
  +        <xsl:choose>
  +          <xsl:when test="example/usage">
  +            <xsl:for-each select="example/usage">
  +              <tr>
  +                <td><b>Examples</b></td>
  +                <td colspan="5" bgcolor="#cccccc">
  +                  <xsl:if test="comment">
  +                    <xsl:value-of select="comment"/>
  +                  </xsl:if> 
  +                  <xsl:text>&#160;</xsl:text>
  +                </td>
  +              </tr>
  +              <tr>
  +                <td><xsl:text>&#160;</xsl:text></td>
  +                <td colspan="5">
  +                  <xsl:for-each select="scriptlet">
  +                    &lt;%<xsl:value-of select="."/>%&gt;<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>
  +                </td>
  +              </tr>
               </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>
  +          </xsl:when>
  +          <xsl:otherwise>
  +            <tr>
  +              <td><b>Examples</b></td>
  +              <td colspan="5">None</td>
  +            </tr>
  +          </xsl:otherwise>
  +        </xsl:choose>
           <!-- End Examples Section -->
  -        </td>
  -      </tr>
  -    </table>
  -    </td>
  -    </tr>
  -    </table>
  -    <!-- End for-each <tag> element here -->
  +      
  +      </table>
  +      <!-- End for-each <tag> element here -->
       </xsl:for-each>
  -    
  -        <!-- Footer Section (Examples, Javadoc, History) called. -->
  -        <xsl:call-template name="footer"/>
  +  </xsl:for-each>
  +  
  +  <!-- Additional TOC sections -->
  +  <xsl:for-each select="toc">
  +    <a><xsl:attribute name="name"><xsl:value-of select="@href"/>
  +      </xsl:attribute>
  +    </a>
  +    <h3><xsl:value-of select="@name"/></h3>
  +    <xsl:copy-of select="*|text()"/>
  +  </xsl:for-each>
  +  <!-- End Additional TOC sections -->
  +  
  +  <!-- 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>