ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/tools/xsl taskdoc-project.xsl taskdoc-summary.xsl taskdoc.xsl
Date Sat, 01 Jun 2002 06:59:53 GMT
adammurdoch    2002/05/31 23:59:53

  Added:       tools/xsl taskdoc-project.xsl taskdoc-summary.xsl
                        taskdoc.xsl
  Log:
  Add some stylesheets to transform generated type docs into xdoc format.
  
  Revision  Changes    Path
  1.1                  jakarta-ant-myrmidon/tools/xsl/taskdoc-project.xsl
  
  Index: taskdoc-project.xsl
  ===================================================================
  <!-- A stylesheet to tranform a typelib summary into an xdocs project file -->
  <xsl:stylesheet version="1.0"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:xalan="http://xml.apache.org/xalan"
                 exclude-result-prefixes="xalan">
      <xsl:output indent="yes" omit-xml-declaration="yes"/>
  
      <xsl:template match="/types">
          <project name="Type Reference">
              <title>Type Reference</title>
              <body>
                  <menu name="Types">
                      <item name="All" href="/index.html"/>
                      <xsl:for-each select="xalan:distinct( type/@role )" >
                          <xsl:sort select="."/>
                          <item name="{.}" href="/index.html#{.}"/>
                      </xsl:for-each>
                  </menu>
              </body>
          </project>
      </xsl:template>
  
  </xsl:stylesheet>
  
  
  1.1                  jakarta-ant-myrmidon/tools/xsl/taskdoc-summary.xsl
  
  Index: taskdoc-summary.xsl
  ===================================================================
  <!-- A stylesheet to tranform a typelib summary into an xdocs index page -->
  <xsl:stylesheet version="1.0"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:xalan="http://xml.apache.org/xalan"
                  exclude-result-prefixes="xalan">
      <xsl:output indent="yes" omit-xml-declaration="yes"/>
  
      <xsl:template match="/types">
          <document>
              <properties>
                  <title>Overview</title>
              </properties>
  
              <body>
                  <xsl:for-each select="xalan:distinct( type/@role )" >
                      <xsl:sort select="."/>
                      <xsl:variable name="rolename" select="."/>
                      <section name="{$rolename}" anchor="{$rolename}">
                          <table>
                              <tr><th>Name</th><th>Description</th></tr>
                              <xsl:for-each select="/types/type[@role = $rolename]">
                                  <xsl:sort select="@name"/>
                                  <tr>
                                      <td>
                                          <a href="{translate( @classname, '.', '/')}.html">
                                              <xsl:value-of select="@name"/>
                                          </a>
                                      </td>
                                      <td><xsl:value-of select="short-description"/></td>
                                  </tr>
                              </xsl:for-each>
                          </table>
                      </section>
                  </xsl:for-each>
              </body>
          </document>
      </xsl:template>
  
  </xsl:stylesheet>
  
  
  1.1                  jakarta-ant-myrmidon/tools/xsl/taskdoc.xsl
  
  Index: taskdoc.xsl
  ===================================================================
  <!-- A stylesheet that transforms type metainfo into xdoc format -->
  <xsl:stylesheet version="1.0"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output indent="yes" omit-xml-declaration="yes"/>
  
      <xsl:template match="/type">
          <xsl:variable name="typename">
              <xsl:value-of select="names/name[1]/@name"/>
          </xsl:variable>
  
          <document>
              <properties>
                  <title><xsl:value-of select="$typename"/></title>
              </properties>
  
          <body>
  
          <section name="{$typename}">
              <p><xsl:apply-templates select="long-description"/></p>
  
              <xsl:apply-templates select="structure"/>
          </section>
  
          </body>
          </document>
  
      </xsl:template>
  
      <xsl:template match="structure">
          <subsection name="Attributes">
              <xsl:choose>
                  <xsl:when test="attributes/attribute">
                      <xsl:apply-templates select="attributes"/>
                  </xsl:when>
                  <xsl:otherwise>
                      <p>None</p>
                  </xsl:otherwise>
              </xsl:choose>
          </subsection>
  
          <subsection name="Nested Elements">
              <xsl:choose>
                  <xsl:when test="elements/element">
                      <xsl:apply-templates select="elements"/>
                  </xsl:when>
                  <xsl:otherwise>
                      <p>None</p>
                  </xsl:otherwise>
              </xsl:choose>
          </subsection>
  
          <subsection name="Text Content">
              <xsl:choose>
                  <xsl:when test="body">
                      <xsl:apply-templates select="body"/>
                  </xsl:when>
                  <xsl:otherwise>
                      <p>None</p>
                  </xsl:otherwise>
              </xsl:choose>
          </subsection>
      </xsl:template>
  
      <xsl:template match="attributes">
          <table>
              <tr><th>Name</th><th>Description</th><th>Type</th></tr>
              <xsl:for-each select="attribute">
                  <tr>
                      <td><xsl:value-of select="@name"/></td>
                      <td><xsl:value-of select="description"/></td>
                      <td><code><xsl:value-of select="@type"/></code></td>
                  </tr>
              </xsl:for-each>
          </table>
      </xsl:template>
  
      <xsl:template match="elements">
          <table>
              <tr><th>Name</th><th>Description</th><th>Type</th></tr>
              <xsl:for-each select="element">
                  <tr>
                      <td><xsl:value-of select="@name"/></td>
                      <td><xsl:value-of select="description"/></td>
                      <td><code><xsl:value-of select="@type"/></code></td>
                  </tr>
              </xsl:for-each>
          </table>
      </xsl:template>
  
      <xsl:template match="body">
          <p>Type: <xsl:value-of select="@type"/></p>
          <p><xsl:value-of select="description"/>.</p>
      </xsl:template>
  
  </xsl:stylesheet>
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message