jmitchell    2003/03/28 21:51:41

  Added:       contrib/tag-doc build.xml
               contrib/tag-doc/src/resources/taglibreport index.xsl
                        overview-frame.xsl stylesheet.css taglib-report.xsl
               contrib/tag-doc/src/resources/taglibdoc all-tags.xsl
                        index.xsl overview-frame.xsl stylesheet.css
                        tag-frame.xsl taglib-frame.xsl taglib-summary.xsl
               contrib/tag-doc/src/java/org/apache/struts/taskdefs
                        EnhMatchingTask.java TaglibDoc.java
                        TaglibReport.java Util.java
  Log:
  Initial checkin.
  New contribution from Mohan Kishore.  See [ANN] on struts-users list for details.
  
  Revision  Changes    Path
  1.1                  jakarta-struts/contrib/tag-doc/build.xml
  
  Index: build.xml
  ===================================================================
  <project name="TaglibDoc" default="compile" basedir=".">
  
    <!-- Load local and user build preferences -->
    <property file="${user.home}/build.properties"/>
    <property file="../build.properties"/>
    <property file="build.properties"/>
  
    <property name="src.dir"           value="src"/>
    <property name="classes.dir"       value="classes"/>
    <property name="dist.dir"          value="dist"/>
    <property name="dist.jar"          value="${dist.dir}/taglib-docs.jar"/>
    <property name="java.dir"          value="${src.dir}/java"/>
    <property name="resources.dir"     value="${src.dir}/resources"/>
    <property name="target.dir"        value="target"/>
    <property name="taglibdoc.dir"     value="${target.dir}/taglibdoc"/>
    <property name="taglibreport.dir"  value="${target.dir}/taglibreport"/>
  
    <!-- This is the doc directoy relative to the jakarta-struts directory from here 
-->
    <property name="struts.doc.dir"    value="../../doc"/>
    <property name="xml.dir"           value="${struts.doc.dir}/userGuide"/>
  
    <!-- Compilation Classpath -->
    <path id="compile.classpath">
      <pathelement location="${classes.dir}"/>
      <pathelement location="${ant.jar}"/>
    </path>
    
    <target name="init">
      <mkdir dir="${classes.dir}"/>
      <mkdir dir="${dist.dir}"/>
    </target>
  
    <target name="compile" depends="init">
      <javac srcdir="${java.dir}" 
            destdir="${classes.dir}" >
        <classpath refid="compile.classpath"/>
      </javac>
    </target>
  
    <target name="dist" depends="compile">
      <copy todir="${classes.dir}/resources">
        <fileset dir="${resources.dir}"/>
      </copy>
      <jar jarfile="${dist.jar}"
        basedir="${classes.dir}"
        includes="**"
        />
    </target>
  
    <target name="taglibdoc" depends="dist">
      <taskdef name="taglibdoc" 
           classname="org.apache.struts.taskdefs.TaglibDoc">
        <classpath path="${dist.jar}"/>
      </taskdef>
  
      <taglibdoc destdir="${taglibdoc.dir}">
        <fileset dir="${xml.dir}">
          <include name="struts-*.xml"/>
        </fileset>
      </taglibdoc>
    </target>
    
    <target name="taglibreport" depends="dist">
      <taskdef name="taglibreport" 
           classname="org.apache.struts.taskdefs.TaglibReport">
        <classpath path="${dist.jar}"/>
      </taskdef>
  
      <taglibreport destdir="${taglibreport.dir}">
        <fileset dir="${xml.dir}">
          <include name="struts-*.xml"/>
        </fileset>
      </taglibreport>
    </target>
  
    <target name="clean">
      <delete dir="${classes.dir}"/>
      <delete dir="${dist.dir}"/>
      <delete dir="${taglibdoc.dir}"/>
      <delete dir="${taglibreport.dir}"/>
    </target>
  
    <target name="generate-reports" depends="taglibdoc, taglibreport"/>
  
  </project>
  
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/resources/taglibreport/index.xsl
  
  Index: index.xsl
  ===================================================================
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output
        method="html"
        version="4.0"
        omit-xml-declaration="yes"
        indent="yes"
  />
  
  <xsl:template match="*">
  <HTML>
  <HEAD>
    <TITLE>Taglib Documentation</TITLE>
  </HEAD>
  <FRAMESET cols="10%,80%">
    <FRAME src="overview-frame.html" name="taglibListFrame"/>
    <FRAME src="" name="taglibFrame"/>
  </FRAMESET>
  
  
  <NOFRAMES>
    <H2>Frame Alert</H2>
    <P/>
    This document is designed to be viewed using the frames feature. 
    If you see this message, you are using a non-frame-capable web client.
    <BR/>
    Link to <A HREF="overview-frame.html">Non-frame version.</A>
  </NOFRAMES>
  
  
  </HTML>
  </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/resources/taglibreport/overview-frame.xsl
  
  Index: overview-frame.xsl
  ===================================================================
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output
        method="html"
        version="4.0"
        omit-xml-declaration="yes"
        indent="yes"
  />
  
  <xsl:template match="*">
  <HTML>
  <HEAD>
    <TITLE>Taglib Reports</TITLE>
    <LINK REL="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style" />
  </HEAD>
  <BODY>
  
  <TABLE BORDER="0" WIDTH="100%">
  <TR>
  <TD NOWRAP="true">
    <DIV CLASS="FrameHeading">
      TagLibs
    </DIV>
    <BR/>
  
  <xsl:for-each select="//shortname">
  <xsl:sort select="."/>
    <xsl:element name="A">
      <xsl:attribute name="TARGET">taglibFrame</xsl:attribute>
      <xsl:attribute name="HREF"><xsl:value-of select="." 
/>-report.html</xsl:attribute>
      <xsl:attribute name="CLASS">FrameItem</xsl:attribute>
        <xsl:value-of select="." />
    </xsl:element>
    <BR/>
  </xsl:for-each>
  
  </TD>
  </TR>
  </TABLE>
  
  </BODY>
  </HTML>
  </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/resources/taglibreport/stylesheet.css
  
  Index: stylesheet.css
  ===================================================================
  /* Javadoc style sheet */
  
  /* Page background color */
  body { background-color: #FFFFFF }
  
  .FrameHeading { 
        font-weight: bold;
        font-size: large;
        text-decoration: none;
  }
  .FrameItem { 
        text-decoration: none;
  }
  .FrameHeading:link, .FrameHeading:visited, .FrameItem:link, .FrameItem:visited {
        color: blue;
  }
  .FrameHeading:hover, .FrameHeading:active, .FrameItem:hover, .FrameItem:active {
        color: #CC3333;
  }
  
  .FrameTitle { 
        font-weight: bold;
        font-size: large;
        text-decoration: none;
  }
  
  .TableHeadingColor     { background: #CCCCFF } /* Dark mauve */
  .TableRowColor         { background: #FFFFFF } /* White */
  
  .TableRowTT            { background: #FFCC99 } /*  Reqd.  RTExprValue */
  .TableRowTF            { background: #FFCC99 } /*  Reqd. !RTExprValue */
  .TableRowFT            { background: #FFFFFF } /* !Reqd.  RTExprValue */
  .TableRowFF            { background: #FFFFFF } /* !Reqd. !RTExprValue */
  
  
  
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/resources/taglibreport/taglib-report.xsl
  
  Index: taglib-report.xsl
  ===================================================================
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output
        method="html"
        version="4.0"
        omit-xml-declaration="yes"
        indent="yes"
  />
  
  <xsl:template match="*">
  <HTML>
  <HEAD>
    <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style" />
  </HEAD>
  <BODY>
  
  <TABLE BORDER="1" WIDTH="100%" CELLSPACING="0" CELLPADDING="0">
  
  <TR CLASS="TableHeadingColor">
  <TD>&#160;</TD>
  <TD NOWRAP="true">&#160;<B>body-content</B>&#160;</TD>
  <xsl:for-each select="//attributes/attribute">
  <xsl:sort select="."/>
    <TD NOWRAP="true" STYLE="width: 75px;">
      &#160;<B><xsl:value-of select="."/></B>&#160;
    </TD>
  </xsl:for-each>
  </TR>
  
  <!-- Add 'bodycontent' as the second column?? -->
  
  <xsl:for-each select="//taglib/tag">
  <xsl:sort select="name"/>
  <TR>
    <xsl:variable name="curr_tag" select="."/>
    <TD CLASS="TableHeadingColor">&#160;<B><xsl:value-of 
select="$curr_tag/name"/></B>&#160;</TD>
    <TD>&#160;<xsl:value-of select="$curr_tag/bodycontent"/>&#160;</TD>
    <xsl:for-each select="//attributes/attribute">
    <xsl:sort select="."/>
      <xsl:variable name="curr_attr" select="."/>
      <xsl:element name="TD">
        <xsl:attribute name="NOWRAP">true</xsl:attribute>
        <xsl:for-each select="$curr_tag/attribute">
        <xsl:sort select="name"/>
          <xsl:if test="./name = $curr_attr">
            <xsl:choose>
              <xsl:when test="./required = 'true'">
                <xsl:attribute name="BGCOLOR">#FF9933</xsl:attribute>
                &#160;
              </xsl:when>
              <xsl:otherwise>
                <xsl:attribute name="BGCOLOR">#FFFF66</xsl:attribute>
                &#160;
              </xsl:otherwise>
            </xsl:choose>
            <xsl:choose>
              <xsl:when test="./rtexprvalue = 'true'">
                RT
              </xsl:when>
            </xsl:choose>
          </xsl:if>
        </xsl:for-each>
        &#160;
      </xsl:element>
    </xsl:for-each>
  </TR>
  </xsl:for-each>
  
  </TABLE>
  
  
  </BODY>
  </HTML>
  </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/resources/taglibdoc/all-tags.xsl
  
  Index: all-tags.xsl
  ===================================================================
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output
        method="html"
        version="4.0"
        omit-xml-declaration="yes"
        indent="yes"
  />
  
  <xsl:template match="*">
  <HTML>
  <HEAD>
    <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style" />
  </HEAD>
  <BODY>
  
  <TABLE BORDER="0" WIDTH="100%">
  <TR>
  <TD NOWRAP="true">
    <DIV CLASS="FrameHeading">
      All Tags
    </DIV>
    <BR/>
  
  <xsl:for-each select="//tag">
  <xsl:sort select="name"/>
    <xsl:element name="A">
      <xsl:attribute name="TARGET">tagFrame</xsl:attribute>
      <xsl:attribute name="HREF"><xsl:value-of select="taglib"/>/<xsl:value-of 
select="name"/>.html</xsl:attribute>
      <xsl:attribute name="CLASS">FrameItem</xsl:attribute>
        <xsl:value-of select="name" />
    </xsl:element>
    <BR/>
  </xsl:for-each>
  
  </TD>
  </TR>
  </TABLE>
  
  
  </BODY>
  </HTML>
  </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  jakarta-struts/contrib/tag-doc/src/resources/taglibdoc/index.xsl
  
  Index: index.xsl
  ===================================================================
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output
        method="html"
        version="4.0"
        omit-xml-declaration="yes"
        indent="yes"
  />
  
  <xsl:template match="*">
  <HTML>
  <HEAD>
    <TITLE>Taglib Documentation</TITLE>
  </HEAD>
  <FRAMESET cols="20%,80%">
    <FRAMESET rows="30%,70%">
      <FRAME src="overview-frame.html" name="taglibListFrame"/>
      <FRAME src="all-tags.html" name="taglibFrame"/>
    </FRAMESET>
    <FRAME src="" name="tagFrame"/>
  </FRAMESET>
  
  
  <NOFRAMES>
    <H2>Frame Alert</H2>
    <P/>
    This document is designed to be viewed using the frames feature. 
    If you see this message, you are using a non-frame-capable web client.
    <BR/>
    Link to <A HREF="overview-frame.html">Non-frame version.</A>
  </NOFRAMES>
  
  
  </HTML>
  </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/resources/taglibdoc/overview-frame.xsl
  
  Index: overview-frame.xsl
  ===================================================================
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output
        method="html"
        version="4.0"
        omit-xml-declaration="yes"
        indent="yes"
  />
  
  <xsl:template match="*">
  <HTML>
  <HEAD>
    <TITLE>Taglib Documentation</TITLE>
    <LINK REL="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style" />
  </HEAD>
  <BODY>
  
  <TABLE BORDER="0" WIDTH="100%">
  <TR>
  <TD NOWRAP="true">
    <DIV>
    <SPAN CLASS="FrameHeading">
      TagLibs
    </SPAN>
    &#160;
    (<A TARGET="taglibFrame" HREF="all-tags.html" CLASS="FrameItem">All Tags</A>)
    </DIV>
    <BR/>
  
  <xsl:for-each select="//shortname">
  <xsl:sort select="."/>
    <xsl:element name="A">
      <xsl:attribute name="TARGET">taglibFrame</xsl:attribute>
      <xsl:attribute name="HREF"><xsl:value-of select="." 
/>/taglib-frame.html</xsl:attribute>
      <xsl:attribute name="CLASS">FrameItem</xsl:attribute>
        <xsl:value-of select="." />
    </xsl:element>
    <BR/>
  </xsl:for-each>
  
  </TD>
  </TR>
  </TABLE>
  
  </BODY>
  </HTML>
  </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/resources/taglibdoc/stylesheet.css
  
  Index: stylesheet.css
  ===================================================================
  /* Javadoc style sheet */
  
  /* Page background color */
  body { background-color: #FFFFFF }
  
  .FrameHeading { 
        font-weight: bold;
        font-size: large;
        text-decoration: none;
  }
  .FrameItem { 
        text-decoration: none;
  }
  .FrameHeading:link, .FrameHeading:visited, .FrameItem:link, .FrameItem:visited {
        color: blue;
  }
  .FrameHeading:hover, .FrameHeading:active, .FrameItem:hover, .FrameItem:active {
        color: #CC3333;
  }
  
  .FrameTitle { 
        font-weight: bold;
        font-size: large;
        text-decoration: none;
  }
  
  .TableHeadingColor     { background: #CCCCFF } /* Dark mauve */
  .TableRowColor         { background: #FFFFFF } /* White */
  
  .TableRowTT            { background: #FFCC99 } /*  Reqd.  RTExprValue */
  .TableRowTF            { background: #FFCC99 } /*  Reqd. !RTExprValue */
  .TableRowFT            { background: #FFFFFF } /* !Reqd.  RTExprValue */
  .TableRowFF            { background: #FFFFFF } /* !Reqd. !RTExprValue */
  
  
  
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/resources/taglibdoc/tag-frame.xsl
  
  Index: tag-frame.xsl
  ===================================================================
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output
        method="html"
        version="4.0"
        omit-xml-declaration="yes"
        indent="yes"
  />
  
  <xsl:template match="*">
  <HTML>
  <HEAD>
    <LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style" />
  </HEAD>
  <BODY>
  
  <!-- ======== START OF TAG DATA ======== -->
  <A NAME="_top"><!-- --></A>
  
  <SPAN CLASS="FrameTitle">
    <xsl:value-of select="taglib"/>:<xsl:value-of select="name"/>
  </SPAN>
  &#160;&#160;&#160;&#160;(
  <A HREF="#_description">description</A>
  )
  
  <P/>
  <!-- ========== ATTRIBUTE SUMMARY =========== -->
  <A NAME="attribute_summary"><!-- --></A>
  
  <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
  <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  <TD COLSPAN="2">
    <SPAN CLASS="FrameHeading">Attribute Summary</SPAN>
  </TD>
  </TR>
  
  <xsl:for-each select="attribute">
  <xsl:sort select="required" order="descending"/>
  <xsl:sort select="name" order="ascending"/>
  <xsl:element name="TR">
    <xsl:attribute name="CLASS">TableRow<xsl:value-of 
select="substring(required,1,1)"/>
      <xsl:value-of select="substring(rtexprvalue,1,1)"/>
    </xsl:attribute>
  <TD ALIGN="right" VALIGN="top" WIDTH="10%"><FONT SIZE="-1">
    &#160;<xsl:if test="rtexprvalue='true'"><CODE>RTExprValue</CODE></xsl:if>
  </FONT></TD>
  <TD>
    <xsl:element name="A">
      <xsl:attribute name="HREF">#<xsl:value-of select="name"/></xsl:attribute>
      <B><CODE><xsl:value-of select="name"/></CODE></B>
    </xsl:element>
  <BR/>
  &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
  <xsl:value-of select="substring(info,1,80)"/>
  </TD>
  </xsl:element>
  </xsl:for-each>
  
  </TABLE>
  
  <P/>
  
  <!-- ============ ATTRIBUTE DETAIL ========== -->
  <A NAME="attribute_detail"><!-- --></A>
  
  <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
  <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  <TD COLSPAN="1">
    <SPAN CLASS="FrameHeading">Attribute Detail</SPAN>
  </TD>
  </TR>
  </TABLE>
  
  <xsl:for-each select="attribute">
  <xsl:sort select="required" order="descending"/>
  <xsl:sort select="name" order="ascending"/>
  <xsl:element name="A">
    <xsl:attribute name="NAME"><xsl:value-of select="name"/></xsl:attribute>
  </xsl:element>
  <H3><xsl:value-of select="name"/></H3>
  <xsl:copy-of select="info"/>
  
  <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
  <TR>
  <TD><B>Required:</B>&#160;&#160;&#160;&#160;</TD>
  <TD><xsl:value-of select="required"/></TD>
  </TR><TR>
  <TD><B>RTExprValue:</B>&#160;&#160;&#160;&#160;</TD>
  <TD><xsl:value-of select="rtexprvalue"/></TD>
  </TR>
  </TABLE>
  <HR/>
  </xsl:for-each>
  
  <P/>
  <P/>
  
  <!-- ============ DESCRIPTION ========== -->
  <A NAME="_description"><!-- --></A>
  
  <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
  <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  <TD COLSPAN="1">
    <SPAN CLASS="FrameHeading">Description</SPAN>
  </TD>
  </TR>
  </TABLE>
  <P/>
  
  <xsl:value-of select="summary" />
  <P/>
  <xsl:copy-of select="info" />
  <P/>
  <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
  <TR>
  <TD><B>Tag Class:</B>&#160;&#160;&#160;&#160;</TD>
  <TD><xsl:value-of select="tagclass"/></TD>
  </TR><TR>
  <TD><B>Tei Class:</B>&#160;&#160;&#160;&#160;</TD>
  <TD><xsl:value-of select="teiclass"/></TD>
  </TR><TR>
  <TD><B>Body Content:</B>&#160;&#160;&#160;&#160;</TD>
  <TD><xsl:value-of select="bodycontent"/></TD>
  </TR>
  </TABLE>
  
  </BODY>
  </HTML>
  </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/resources/taglibdoc/taglib-frame.xsl
  
  Index: taglib-frame.xsl
  ===================================================================
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output
        method="html"
        version="4.0"
        omit-xml-declaration="yes"
        indent="yes"
  />
  
  <xsl:template match="*">
  <HTML>
  <HEAD>
    <LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style" />
  </HEAD>
  <BODY>
  
  <TABLE BORDER="0" WIDTH="100%">
  <TR>
  <TD NOWRAP="true">
    <DIV>
    <xsl:element name="A">
      <xsl:attribute name="TARGET">tagFrame</xsl:attribute>
      <xsl:attribute name="HREF">taglib-summary.html</xsl:attribute>
      <xsl:attribute name="CLASS">FrameHeading</xsl:attribute>
        <xsl:value-of select="//taglib/shortname" />
    </xsl:element>
    </DIV>
    <BR/>
  
  <xsl:for-each select="//taglib/tag">
  <xsl:sort select="name"/>
    <xsl:element name="A">
      <xsl:attribute name="TARGET">tagFrame</xsl:attribute>
      <xsl:attribute name="HREF"><xsl:value-of select="name" />.html</xsl:attribute>
      <xsl:attribute name="CLASS">FrameItem</xsl:attribute>
        <xsl:value-of select="name" />
    </xsl:element>
    <BR/>
  </xsl:for-each>
  
  </TD>
  </TR>
  </TABLE>
  
  
  </BODY>
  </HTML>
  </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/resources/taglibdoc/taglib-summary.xsl
  
  Index: taglib-summary.xsl
  ===================================================================
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output
        method="html"
        version="4.0"
        omit-xml-declaration="yes"
        indent="yes"
  />
  
  <xsl:template match="*">
  <HTML>
  <HEAD>
    <LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style" />
  </HEAD>
  <BODY>
  
  <!-- ======== START OF TAG DATA ======== -->
  <A NAME="_top"><!-- --></A>
  
  <SPAN CLASS="FrameTitle">
    <xsl:value-of select="//taglib/display-name" />
  </SPAN>
  &#160;&#160;&#160;&#160;(
  <A HREF="#_description">description</A>
  )
  
  <P/>
  <!-- ========== TAG SUMMARY =========== -->
  <A NAME="tag_summary"><!-- --></A>
  
  <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
  <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  <TD COLSPAN="2">
    <SPAN CLASS="FrameHeading">Tag Summary</SPAN>
  </TD>
  </TR>
  
  <xsl:for-each select="//taglib/tag">
  <xsl:sort select="name" order="ascending"/>
  <xsl:element name="TR">
    <xsl:attribute name="CLASS">TableRow</xsl:attribute>
  <TD VALIGN="top" WIDTH="10%">
    <xsl:element name="A">
      <xsl:attribute name="HREF"><xsl:value-of select="name"/>.html</xsl:attribute>
      <B><CODE><xsl:value-of select="name"/></CODE></B>
    </xsl:element>
  </TD>
  <TD>
    <xsl:value-of select="summary"/>
  </TD>
  </xsl:element>
  </xsl:for-each>
  
  </TABLE>
  
  <P/>
  <P/>
  
  <!-- ============ DESCRIPTION ========== -->
  <A NAME="_description"><!-- --></A>
  
  <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
  <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  <TD COLSPAN="1">
    <SPAN CLASS="FrameHeading">Description</SPAN>
  </TD>
  </TR>
  </TABLE>
  <P/>
  
  <xsl:copy-of select="//taglib/info" />
  <P/>
  <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
  <TR>
  <TD><B>TagLib Version:</B>&#160;&#160;&#160;&#160;</TD>
  <TD><xsl:value-of select="//taglib/tlibversion"/></TD>
  </TR><TR>
  <TD><B>JSP Version:</B>&#160;&#160;&#160;&#160;</TD>
  <TD><xsl:value-of select="//taglib/jspversion"/></TD>
  </TR><TR>
  <TD><B>Short Name:</B>&#160;&#160;&#160;&#160;</TD>
  <TD><xsl:value-of select="//taglib/shortname"/></TD>
  </TR><TR>
  <TD><B>URI:</B>&#160;&#160;&#160;&#160;</TD>
  <TD>
    <xsl:element name="A">
      <xsl:attribute name="HREF">
        <xsl:value-of select="//taglib/uri"/>
      </xsl:attribute>
      <xsl:value-of select="//taglib/uri"/>
    </xsl:element>
  </TD>
  </TR>
  </TABLE>
  
  </BODY>
  </HTML>
  </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/java/org/apache/struts/taskdefs/EnhMatchingTask.java
  
  Index: EnhMatchingTask.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-struts/contrib/tag-doc/src/java/org/apache/struts/taskdefs/EnhMatchingTask.java,v
 1.1 2003/03/29 05:51:41 jmitchell Exp $
   * $Revision: 1.1 $
   * $Date: 2003/03/29 05:51:41 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Struts", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.struts.taskdefs;
  
  import java.io.File;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  
  import org.apache.tools.ant.DirectoryScanner;
  import org.apache.tools.ant.taskdefs.MatchingTask;
  import org.apache.tools.ant.types.FileSet;
  
  /**
   * ENHanced-MatchingTask - enhances the MatchingTask by allowing
   * the subclasses to act as a FileSet container as well as allowing
   * the implicit FileSet.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Mohan Kishore</a>
   * @version $Revision: 1.1 $ $Date: 2003/03/29 05:51:41 $
   */
  
  public abstract class EnhMatchingTask extends MatchingTask {
        /** Base directory for implicit FileSet */
        protected File dir;
        /** List of embeded filesets */
        protected List filesets = new ArrayList();
  
        /**
         * Set the base directory for the implicit FileSet
         * @param base directory for implicit FileSet
         */
        public void setDir(File dir) {
                this.dir = dir;
        }
        /**
         * Adds an embeded FileSet for this task.
         * @param the FileSet to add
         */
        public void addFileset(FileSet fileset) {
                filesets.add(fileset);
        }
  
        /**
         * Returns the combined list of Files, from both the
         * implicit and embeded FileSets.
         * @return list of File objects
         */
        protected List getFiles() {
                List files = new ArrayList();
                if (dir != null) {
                        fileset.setDir(dir);
                        files.addAll(getFiles(fileset));
                }
                Iterator iter = filesets.iterator();
                while (iter.hasNext()) {
                        files.addAll(getFiles((FileSet) iter.next()));
                }
                return files;
        }
        private List getFiles(FileSet fs) {
                List files = new ArrayList();
                DirectoryScanner ds = fs.getDirectoryScanner(fs.getProject());
                File dir = ds.getBasedir();
                String[] filenames = ds.getIncludedFiles();
                for (int i = 0; i < filenames.length; i++) {
                        File file = new File(dir, filenames[i]);
                        files.add(file);
                }
                return files;
        }
  }
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/java/org/apache/struts/taskdefs/TaglibDoc.java
  
  Index: TaglibDoc.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-struts/contrib/tag-doc/src/java/org/apache/struts/taskdefs/TaglibDoc.java,v
 1.1 2003/03/29 05:51:41 jmitchell Exp $
   * $Revision: 1.1 $
   * $Date: 2003/03/29 05:51:41 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Struts", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.struts.taskdefs;
  
  import java.io.File;
  import java.util.Arrays;
  import java.util.Iterator;
  import java.util.List;
  
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.DocumentBuilderFactory;
  import javax.xml.transform.Result;
  import javax.xml.transform.Source;
  import javax.xml.transform.Transformer;
  import javax.xml.transform.TransformerFactory;
  import javax.xml.transform.dom.DOMSource;
  import javax.xml.transform.stream.StreamResult;
  import javax.xml.transform.stream.StreamSource;
  
  import org.apache.tools.ant.BuildException;
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  
  /**
   * Given a list of files compatible with the Tag-Library
   * Descriptor (TLD) format, creates a matrix of Tags Vs
   * Attributes for each Tag-Library.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Mohan Kishore</a>
   * @version $Revision: 1.1 $ $Date: 2003/03/29 05:51:41 $
   */
  public class TaglibDoc extends EnhMatchingTask {
        private File destdir;
        /**
         * Sets the destination directory for the generated documents.
         * @param destdir The destination directory
         */
        public void setDestdir(File destdir) {
                this.destdir = destdir;
        }
        /**
         * Called by the Ant runtime. Needs to have the mandatory attribute
         * 'destdir' set before calling this.
         */
        public void execute() throws BuildException {
                validate();
                handleFiles(getFiles());
        }
        private void validate() throws BuildException {
                if (destdir == null) {
                        throw new BuildException("Need to specify the 'destdir' 
attribute");
                }
                if (!destdir.exists() || !destdir.isDirectory()) {
                        if (!destdir.mkdirs()) {
                                throw new BuildException("Could not create the 
specified destdir");
                        }
                }
        }
  
        /**
         * Creates the following set of documents:<BR/>
         * <PRE>
         *   DestDir
         *    |- index.html (the frames based index page)
         *    |- overview-frame.html (list of all tag-libraries)
         *    |- all-tags.html (list of all tags)
         *    |- XXX (one directory per tag library)
         *    |   |- taglib-frame.html (list of all tags in this library)
         *    |   |- taglib-summary.html (summary of this library)
         *    |   |- YYY.html (one file per Tag)
         *    |   |- ...
         *    |- ...
         * </PRE>
         * @param files input files in TLD format.
         */
        public void handleFiles(List files) {
                try {
                        DocumentBuilderFactory dbf = 
DocumentBuilderFactory.newInstance();
                        DocumentBuilder db = dbf.newDocumentBuilder();
                        Document doc = db.newDocument();
                        Element overviewRoot =
                                Util.addChildElement(doc, "overview-frame", null);
                        doc = db.newDocument();
                        Element allTagsRoot = Util.addChildElement(doc, "all-tags", 
null);
  
                        Iterator iter = files.iterator();
                        while (iter.hasNext()) {
                                File file = (File) iter.next();
                                if (!file.exists() || !file.canRead()) {
                                        continue;
                                }
                                Document xmlDoc = handleFile(file);
                                if (xmlDoc != null) {
                                        String shortname =
                                                Util.getElementValue(
                                                        xmlDoc.getDocumentElement(),
                                                        "body/taglib/shortname");
                                        Util.addChildElement(overviewRoot, 
"shortname", shortname);
  
                                        List tags =
                                                Util.getElements(
                                                        xmlDoc.getDocumentElement(),
                                                        "body/taglib/tag");
                                        Iterator tagIter = tags.iterator();
                                        while (tagIter.hasNext()) {
                                                Element tag = (Element) tagIter.next();
                                                String tagname = 
Util.getElementValue(tag, "name");
                                                tag = 
Util.addChildElement(allTagsRoot, "tag", null);
                                                Util.addChildElement(tag, "name", 
tagname);
                                                Util.addChildElement(tag, "taglib", 
shortname);
                                        }
                                }
                        }
  
                        Source xml = new DOMSource(overviewRoot);
                        Source xsl =
                                new StreamSource(
                                        this.getClass().getResourceAsStream(
                                                "/resources/taglibdoc/index.xsl"));
                        Result out = new StreamResult(new File(destdir, "index.html"));
                        TransformerFactory tf = TransformerFactory.newInstance();
                        Transformer t = tf.newTransformer(xsl);
                        t.transform(xml, out);
  
                        xsl =
                                new StreamSource(
                                        this.getClass().getResourceAsStream(
                                                
"/resources/taglibdoc/overview-frame.xsl"));
                        out = new StreamResult(new File(destdir, 
"overview-frame.html"));
                        t = tf.newTransformer(xsl);
                        t.transform(xml, out);
  
                        xml = new DOMSource(allTagsRoot);
                        xsl =
                                new StreamSource(
                                        this.getClass().getResourceAsStream(
                                                "/resources/taglibdoc/all-tags.xsl"));
                        out = new StreamResult(new File(destdir, "all-tags.html"));
                        t = tf.newTransformer(xsl);
                        t.transform(xml, out);
  
                        Util.copyFile(
                                "/resources/taglibdoc/stylesheet.css",
                                new File(destdir, "stylesheet.css"));
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }
        private Document handleFile(File file) {
                try {
                        DocumentBuilderFactory dbf = 
DocumentBuilderFactory.newInstance();
                        DocumentBuilder db = dbf.newDocumentBuilder();
                        Document doc = db.parse(file);
                        String shortname =
                                Util.getElementValue(
                                        doc.getDocumentElement(),
                                        "body/taglib/shortname");
  
                        File dir = new File(destdir, shortname);
                        dir.mkdir();
  
                        File taglibFrameHtml = new File(dir, "taglib-frame.html");
                        Source xml = new StreamSource(file);
                        Source xsl =
                                new StreamSource(
                                        this.getClass().getResourceAsStream(
                                                
"/resources/taglibdoc/taglib-frame.xsl"));
                        Result out = new StreamResult(taglibFrameHtml);
                        TransformerFactory tf = TransformerFactory.newInstance();
                        Transformer t = tf.newTransformer(xsl);
                        t.transform(xml, out);
  
                        File taglibSummaryHtml = new File(dir, "taglib-summary.html");
                        xml = new StreamSource(file);
                        xsl =
                                new StreamSource(
                                        this.getClass().getResourceAsStream(
                                                
"/resources/taglibdoc/taglib-summary.xsl"));
                        out = new StreamResult(taglibSummaryHtml);
                        t = tf.newTransformer(xsl);
                        t.transform(xml, out);
  
                        List tags =
                                Util.getElements(doc.getDocumentElement(), 
"body/taglib/tag");
                        Iterator iter = tags.iterator();
                        xsl =
                                new StreamSource(
                                        this.getClass().getResourceAsStream(
                                                "/resources/taglibdoc/tag-frame.xsl"));
                        t = tf.newTransformer(xsl);
                        while (iter.hasNext()) {
                                Element tag = (Element) iter.next();
                                Util.addChildElement(tag, "taglib", shortname);
                                String tagname = Util.getElementValue(tag, "name");
                                File tagHtml = new File(dir, tagname + ".html");
                                xml = new DOMSource(tag);
                                out = new StreamResult(tagHtml);
                                t.transform(xml, out);
                        }
  
                        return doc;
                } catch (Exception e) {
                        e.printStackTrace();
                }
                return null;
        }
  
        /**
         * MAIN METHOD
         */
        public static void main(String[] args) throws Exception {
                if (args.length == 0) {
                        System.out.println(
                                "Usage: java " + TaglibDoc.class.getName() + " <file 
list>");
                        System.exit(0);
                }
  
                File[] files = new File[args.length];
                for (int i = 0; i < files.length; i++)
                        files[i] = new File(args[i]);
                TaglibDoc td = new TaglibDoc();
                td.handleFiles(Arrays.asList(files));
  
        }
  }
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/java/org/apache/struts/taskdefs/TaglibReport.java
  
  Index: TaglibReport.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-struts/contrib/tag-doc/src/java/org/apache/struts/taskdefs/TaglibReport.java,v
 1.1 2003/03/29 05:51:41 jmitchell Exp $
   * $Revision: 1.1 $
   * $Date: 2003/03/29 05:51:41 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Struts", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.struts.taskdefs;
  
  import java.io.File;
  import java.util.Arrays;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Set;
  import java.util.TreeSet;
  
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.DocumentBuilderFactory;
  import javax.xml.transform.Result;
  import javax.xml.transform.Source;
  import javax.xml.transform.Transformer;
  import javax.xml.transform.TransformerFactory;
  import javax.xml.transform.dom.DOMSource;
  import javax.xml.transform.stream.StreamResult;
  import javax.xml.transform.stream.StreamSource;
  
  import org.apache.tools.ant.BuildException;
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  
  /**
   * Given a list of files compatible with the Tag-Library
   * Descriptor (TLD) format, creates a matrix of Tags Vs
   * Attributes for each Tag-Library.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Mohan Kishore</a>
   * @version $Revision: 1.1 $ $Date: 2003/03/29 05:51:41 $
   */
  public class TaglibReport extends EnhMatchingTask {
        private File destdir;
        /**
         * Sets the destination directory for the generated documents.
         * @param destdir The destination directory
         */
        public void setDestdir(File destdir) {
                this.destdir = destdir;
        }
        /**
         * Called by the Ant runtime. Needs to have the mandatory attribute
         * 'destdir' set before calling this.
         */
        public void execute() throws BuildException {
                validate();
                handleFiles(getFiles());
        }
        private void validate() throws BuildException {
                if (destdir == null) {
                        throw new BuildException("Need to specify the 'destdir' 
attribute");
                }
                if (!destdir.exists() || !destdir.isDirectory()) {
                        if (!destdir.mkdirs()) {
                                throw new BuildException("Could not create the 
specified destdir");
                        }
                }
        }
  
        /**
         * Creates the following set of documents:<BR/>
         * <PRE>
         *   DestDir
         *    |- index.html (the frames based index page)
         *    |- overview-frame.html (menu of all tag-libraries)
         *    |- XXX-report.html (one file per tag-library)
         *    |- ...
         * </PRE>
         * @param files input files in TLD format.
         */
        public void handleFiles(List files) {
                try {
                        DocumentBuilderFactory dbf = 
DocumentBuilderFactory.newInstance();
                        DocumentBuilder db = dbf.newDocumentBuilder();
                        Document doc = db.newDocument();
                        Element overviewRoot =
                                Util.addChildElement(doc, "overview-frame", null);
  
                        Iterator iter = files.iterator();
                        while (iter.hasNext()) {
                                File file = (File) iter.next();
                                if (!file.exists() || !file.canRead()) {
                                        continue;
                                }
                                Document xmlDoc = handleFile(file);
                                if (xmlDoc != null) {
                                        String shortname =
                                                Util.getElementValue(
                                                        xmlDoc.getDocumentElement(),
                                                        "body/taglib/shortname");
                                        Util.addChildElement(overviewRoot, 
"shortname", shortname);
  
                                        File reportHtml =
                                                new File(destdir, shortname + 
"-report.html");
                                        Source xml = new DOMSource(xmlDoc);
                                        Source xsl =
                                                new StreamSource(
                                                        
this.getClass().getResourceAsStream(
                                                                
"/resources/taglibreport/taglib-report.xsl"));
                                        Result out = new StreamResult(reportHtml);
                                        TransformerFactory tf = 
TransformerFactory.newInstance();
                                        Transformer t = tf.newTransformer(xsl);
                                        t.transform(xml, out);
                                }
                        }
  
                        Source xml = new DOMSource(overviewRoot);
                        Source xsl =
                                new StreamSource(
                                        this.getClass().getResourceAsStream(
                                                "/resources/taglibreport/index.xsl"));
                        Result out = new StreamResult(new File(destdir, "index.html"));
                        TransformerFactory tf = TransformerFactory.newInstance();
                        Transformer t = tf.newTransformer(xsl);
                        t.transform(xml, out);
  
                        xsl =
                                new StreamSource(
                                        this.getClass().getResourceAsStream(
                                                
"/resources/taglibreport/overview-frame.xsl"));
                        out = new StreamResult(new File(destdir, 
"overview-frame.html"));
                        t = tf.newTransformer(xsl);
                        t.transform(xml, out);
  
                        Util.copyFile(
                                "/resources/taglibreport/stylesheet.css",
                                new File(destdir, "stylesheet.css"));
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }
        private Document handleFile(File file) {
                try {
                        Set attrSet = new TreeSet();
  
                        DocumentBuilderFactory dbf = 
DocumentBuilderFactory.newInstance();
                        DocumentBuilder db = dbf.newDocumentBuilder();
                        Document doc = db.parse(file);
  
                        List tags =
                                Util.getElements(doc.getDocumentElement(), 
"body/taglib/tag");
                        Iterator iter = tags.iterator();
                        while (iter.hasNext()) {
                                Element tag = (Element) iter.next();
                                List attrList = Util.getElements(tag, "attribute");
                                Iterator attrIter = attrList.iterator();
                                while (attrIter.hasNext()) {
                                        Element attribute = (Element) attrIter.next();
                                        String name = Util.getElementValue(attribute, 
"name");
                                        attrSet.add(name);
                                }
                        }
  
                        Element attributes =
                                Util.addChildElement(
                                        doc.getDocumentElement(),
                                        "attributes",
                                        null);
                        iter = attrSet.iterator();
                        while (iter.hasNext()) {
                                String name = (String) iter.next();
                                Util.addChildElement(attributes, "attribute", name);
                        }
  
                        return doc;
                } catch (Exception e) {
                        e.printStackTrace();
                }
                return null;
        }
  
        /**
         * MAIN METHOD
         */
        public static void main(String[] args) throws Exception {
                if (args.length == 0) {
                        System.out.println(
                                "Usage: java " + TaglibReport.class.getName() + " 
<file list>");
                        System.exit(0);
                }
  
                File[] files = new File[args.length];
                for (int i = 0; i < files.length; i++)
                        files[i] = new File(args[i]);
                TaglibDoc td = new TaglibDoc();
                td.handleFiles(Arrays.asList(files));
  
        }
  }
  
  
  1.1                  
jakarta-struts/contrib/tag-doc/src/java/org/apache/struts/taskdefs/Util.java
  
  Index: Util.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-struts/contrib/tag-doc/src/java/org/apache/struts/taskdefs/Util.java,v
 1.1 2003/03/29 05:51:41 jmitchell Exp $
   * $Revision: 1.1 $
   * $Date: 2003/03/29 05:51:41 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Struts", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.struts.taskdefs;
  
  import java.io.BufferedInputStream;
  import java.io.File;
  import java.io.FileOutputStream;
  import java.util.ArrayList;
  import java.util.List;
  
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  import org.w3c.dom.Node;
  import org.w3c.dom.NodeList;
  
  /**
   * General purpose utility class.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Mohan Kishore</a>
   * @version $Revision: 1.1 $ $Date: 2003/03/29 05:51:41 $
   */
  public class Util {
        /**
         * Returns the list of named descendents. Allows the user
         * to specify '/' separated path to the child element. e.g.
         * 'a/b/c'. Note, that if 'a' has multiple child elements
         * named 'b', the method will go to the first 'b' element,
         * and return all child elements named 'c'. Returns an
         * empty List if the path does not return any elements.
         *
         * @param elem The parent/context element
         * @param path '/' separated path
         * @return List of elements as per the path.
         */
        public static List getElements(Element elem, String path) {
                List list = new ArrayList();
                if (elem == null)
                        return list;
  
                int ndx = path.indexOf("/");
                if (ndx != -1) {
                        Element child = getElement(elem, path.substring(0, ndx));
                        return getElements(child, path.substring(ndx + 1));
                }
                NodeList nl = elem.getChildNodes();
                for (int i = 0, len = nl.getLength(); i < len; i++) {
                        Node node = nl.item(i);
                        if (node.getNodeType() == Node.ELEMENT_NODE
                                && node.getNodeName().equals(path)) {
                                list.add(node);
                        }
                }
                return list;
        }
        /**
         * Returns the named descendent. Allows the user
         * to specify '/' separated path to the child element. e.g.
         * 'a/b/c'. Note, that in case of multiple children with the
         * same name, the first child is returned. Returns a null, if
         * the path does not map to any element.
         *
         * @param elem The parent/context element
         * @param path '/' separated path
         * @return Named element as per the path.
         */
        public static Element getElement(Element elem, String path) {
                List elems = getElements(elem, path);
                if (elems.size() == 0)
                        return null;
                else
                        return (Element) elems.get(0);
        }
        /**
         * Returns the text value of the named descendent. Allows the user
         * to specify '/' separated path to the child element. e.g.
         * 'a/b/c'. Note, that in case of multiple children with the
         * same name, the first child is considered. The text value
         * is determined by concatenating all the text children. Returns
         * an empty String if node is not found.
         *
         * @param elem The parent/context element
         * @param path '/' separated path
         * @return Text value of the name descendent.
         */
        public static String getElementValue(Element elem, String path) {
                Element child = getElement(elem, path);
                if (child == null)
                        return "";
  
                String ret = "";
                NodeList nl = child.getChildNodes();
                for (int i = 0, len = nl.getLength(); i < len; i++) {
                        Node node = nl.item(i);
                        if (node.getNodeType() == Node.TEXT_NODE)
                                ret += node.getNodeValue();
                }
                return ret;
        }
        /**
         * Adds a Child element to the parent node. If the 'value' is
         * not null, a Text node with the same value is appended to the
         * Child.
         * @param parent The parent node
         * @param tag The child element name
         * @param value Value of text node appended to the Child
         * @return the newly added Child node.
         */
        public static Element addChildElement(
                Node parent,
                String tag,
                String value) {
                Document doc =
                        (parent.getNodeType() == Node.DOCUMENT_NODE)
                                ? (Document) parent
                                : parent.getOwnerDocument();
                Element child = doc.createElement(tag);
                if (value != null)
                        child.appendChild(doc.createTextNode(value));
                parent.appendChild(child);
                return child;
        }
  
        /**
         * Copies a given resource from classpath to the destination file.
         * Uses Util.class.getResourceAsStream(resPath) internally.
         * @param resPath Path to the resource
         * @param dstFile Destination file
         * @return true, if the file is copied successfully.
         */
        public static boolean copyFile(String resPath, File dstFile) {
                try {
                        BufferedInputStream bis =
                                new BufferedInputStream(
                                        Util.class.getResourceAsStream(resPath));
                        FileOutputStream fos = new FileOutputStream(dstFile);
                        int offset = 0, len = 0;
                        byte[] buffer = new byte[2 * 1024];
                        while ((len = bis.read(buffer, 0, buffer.length)) != -1) {
                                fos.write(buffer, 0, len);
                                offset += len;
                        }
                        bis.close();
                        fos.flush();
                        fos.close();
                        return true;
                } catch (Exception e) {
                        e.printStackTrace();
                }
                return false;
        }
  
  }
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to