home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _55D8AC1C45974C7CB6BD2675DF8CA2BF < prev    next >
Encoding:
Extensible Markup Language  |  2002-08-26  |  17.5 KB  |  388 lines

  1. <?xml-stylesheet type="text/xsl" href="pap-documentation.xsl"?>
  2. <xsl:stylesheet 
  3.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4.     xmlns:doc="urn:schemas-uspto-gov:document"
  5.     exclude-result-prefixes="doc"
  6.     version="1.0">
  7.  
  8. <xsl:import href="pap.xsl" doc:description="The "driver" file for the XSL tranformation resulting in an HTML document
  9.          from a <patent-application-publication> XML document instance.    
  10.          The pap.xsl file calls its child templates through <xsl:include>"/>
  11.  
  12. <xsl:output method="xml" indent="yes" media-type="text/html"/>
  13.  
  14.     
  15.     <doc:summary>
  16.         <doc:title>Patent Application Publication Documentation</doc:title>
  17.         <doc:filename>pap-documentation.xsl</doc:filename>
  18.         <doc:version>1.0</doc:version>
  19.         <doc:dateCreated>2001-02-16</doc:dateCreated>
  20.         <doc:lastModified>2001-02-16</doc:lastModified>
  21.         <doc:description>Genarates a summary of characteristics of the XSLT stylesheets used 
  22.         for the Patent Application Publication doctype.
  23.         </doc:description>
  24.     </doc:summary>
  25.     
  26.    <xsl:template name="displayPage" doc:public="no" doc:description="The displayPage named template is the 
  27.    heart of the documentation.xsl stylesheet, and coordinates the display of all other elements. 
  28.    You can call this as a named template from your own routines as well, by passing the code 
  29.    to be documented as a node set to the $stylesheet parameter and setting $isRootPage to "yes".
  30.    The details of this are included in the article Document Your XSLT by Kurt Cagle. Documentation Generator is copyright 2000 by 
  31.    Kurt Cagle, customized for USPTO by John Dunning, 2001.  For use in commercial products, please contact the author for permissions.">
  32.     
  33.         <xsl:param name="stylesheet" doc:description="This should be the document node (<xsl:stylesheet>)
  34.         of the stylesheet to be documented. Note that if you apply documentation.xsl as 
  35.         an executed stylesheet, this will be done automatically."/>
  36.         <xsl:param name="isRootPage" select="'no'" doc:description="This is useful to 
  37.         insure that even if there is no <doc:summary> that some kind of title 
  38.         description will appear for the document. Set to "yes" to make sure this happens, 
  39.         as it normally defaults to "no"."/>
  40.    
  41.            <xsl:for-each select="$stylesheet">
  42.             <xsl:choose>
  43.                 <xsl:when test="//doc:summary">
  44.                     <xsl:apply-templates select="//doc:summary"/>
  45.                 </xsl:when>
  46.                 <xsl:otherwise>
  47.                     <xsl:if test="$isRootPage='yes'">
  48.                     <h2>Current Stylesheet</h2>
  49.                     </xsl:if>
  50.                 </xsl:otherwise>
  51.             </xsl:choose>
  52.                 <xsl:call-template name="outputDisplay">
  53.                     <xsl:with-param name="outputNodeCnd" select="//xsl:output"/>
  54.                     <xsl:with-param name="stylesheet" select="//xsl:stylesheet"/>
  55.                 </xsl:call-template>
  56.                 
  57.                 <xsl:if test="//xsl:import">
  58.                     <h3>Imports</h3>
  59.                     <ul>
  60.                         <xsl:apply-templates select="//xsl:import"/>
  61.                     </ul>
  62.                 </xsl:if>
  63.                 <xsl:if test="//xsl:include">
  64.                     <h3>Includes</h3>
  65.                     <ul>
  66.                         <xsl:apply-templates select="//xsl:include"/>
  67.                     </ul>
  68.                 </xsl:if>
  69.                 <xsl:if test="//xsl:stylesheet/xsl:param">
  70.                     <h3>Global Parameters</h3> 
  71.                     <ul>
  72.                         <xsl:apply-templates select="//xsl:stylesheet/xsl:param"/>
  73.                     </ul>
  74.                 </xsl:if>
  75.                 <xsl:if test="//xsl:stylesheet/xsl:variable[@doc:public='yes']">
  76.                     <h3>Global Variables</h3>
  77.                     <ul>
  78.                         <xsl:apply-templates select="//xsl:stylesheet/xsl:variable"/>
  79.                     </ul>
  80.                 </xsl:if>
  81.         <h5>Element Template Rules:     <xsl:value-of select="count(xsl:template/@match)" /></h5>
  82.  
  83.         <xsl:for-each select="xsl:template/@match">
  84.             <xsl:if test="not(substring(., 1, 3)='doc') and not(substring(.,1,3)='xsl')">
  85.             <span style="background-color:addfff">
  86.                    <xsl:value-of select="." />
  87.             </span>
  88.             </xsl:if>
  89.         </xsl:for-each>
  90.                 
  91.                 
  92.                 <xsl:apply-templates select="//xsl:template[@match and not(@mode)]"/>
  93.                 <xsl:apply-templates select="//xsl:template[@name]"/>
  94.                 <xsl:apply-templates select="//xsl:template[@mode]"/>
  95.                 <xsl:apply-templates select="//doc:example"/>
  96.         </xsl:for-each>
  97.     </xsl:template>
  98.     
  99.     <xsl:template match="/">
  100.         <html>
  101.         <head><title>Patent Application Stylesheet Documentation</title></head>
  102.             <body>
  103.             <basefont size="2">
  104.             <style>
  105.             td {font-size: 10pt;}
  106.             .containedDocumentation {border:inset 2px green;}
  107.             .importTitle {background-color:navy;color:white;font-size:14pt;}
  108.             .includeTitle {background-color:blue;color:white;font-size:14pt;}
  109.             </style>
  110.             <script language="JavaScript">
  111.             function showHideImportData(id){
  112.                 var importBlock=document.all(id);
  113.                     if (importBlock.style.display=='none'){
  114.                         importBlock.style.display='block';
  115.                         }
  116.                     else {
  117.                         importBlock.style.display='none';
  118.                         }
  119.                     }
  120.             </script>
  121.             <table width="100%">
  122.             <tr><td bgcolor="blue" align="center"><font color="white"><b>xsl:include</b></font></td>
  123.                 <td bgcolor="navy" align="center"><font color="white"><b>xsl:import</b></font></td>
  124.                 <td bgcolor="addfff" align="center">xsl:template match</td>
  125.                 <td bgcolor="eff7ff" align="center">xsl:template name</td>
  126.                 <td bgcolor="red" align="center">xsl:variable</td>
  127.                 <td bgcolor="ff00ff" align="center">xsl:param</td>
  128.             </tr>
  129.             </table>
  130.         <xsl:call-template name="displayPage">
  131.             <xsl:with-param name="stylesheet" select="//xsl:stylesheet"/>
  132.             <xsl:with-param name="isRootPage" select="'yes'"/>
  133.         </xsl:call-template>
  134.             </basefont>
  135.             </body>
  136.         </html>        
  137.     </xsl:template>
  138.     
  139.     <xsl:template match="doc:summary">
  140.         <h3><xsl:value-of select="doc:title"/></h3>
  141.         <h4>File:             <xsl:value-of select="doc:filename"/></h4>
  142.         <table width="30%">
  143.             <tr><td>Version:</td><td><xsl:value-of select="doc:version"/></td></tr>
  144.             <xsl:if test="doc:doctype">
  145.                 <tr><td>DTD Version:</td><td><xsl:value-of select="doc:doctype" /></td></tr>
  146.             </xsl:if>
  147.             <xsl:if test="doc:doctype-date">
  148.                 <tr><td>DTD Revision Date: </td><td><xsl:value-of select="doc:doctype-date" /></td></tr>
  149.              </xsl:if>
  150.             <tr><td>Date Created: </td>
  151.                 <td><xsl:value-of select="doc:dateCreated"/></td></tr>
  152.             <tr><td>Date Last Modified:</td>
  153.                 <td><xsl:value-of select="doc:lastModified" /></td></tr>
  154.             </table>
  155.          <h4>Description</h4>
  156.         <div><xsl:copy-of select="doc:description"/></div>
  157.         <br/>
  158.     </xsl:template>
  159.  
  160.     <xsl:template match="doc:attribute">
  161.         <h4><xsl:value-of select="doc:title"/></h4>
  162.         <div><xsl:value-of select="doc:description"/></div>
  163.     </xsl:template>
  164.  
  165.     <xsl:template match="xsl:template[@match]"/>
  166.     <!--xsl:template match="xsl:template[@match and @doc:public='no']"/-->
  167.  
  168.     <xsl:template match="xsl:template[@name]"/>
  169.     
  170.     <xsl:template match="xsl:template[@name and not(@doc:public='no')]">
  171.         <h4><span style="background-color:#eff7ff;">Named Template: <xsl:value-of select="@name"/></span></h4>
  172.         <div><xsl:value-of select="./@doc:description"/></div>
  173.         <xsl:if test="./xsl:param">
  174.             <h5>Parameters</h5>
  175.         </xsl:if>
  176.         <ul>
  177.         <xsl:for-each select="xsl:param[not(@doc:private='yes')]">
  178.             <li><b><xsl:value-of select="@name"/>. </b> <xsl:value-of select="@doc:description"/>
  179.             <xsl:choose>
  180.                 <xsl:when test="@select">
  181.                     <i>[default=<xsl:value-of select="@select"/>]</i>
  182.                 </xsl:when>
  183.                 <xsl:otherwise>
  184.                     <i>[default=<xsl:value-of select="."/>]</i>
  185.                 </xsl:otherwise>
  186.             </xsl:choose>
  187.             </li>
  188.         </xsl:for-each>
  189.         </ul>
  190.     </xsl:template>
  191.  
  192.     <xsl:template match="xsl:template[@match and @doc:public='yes']">
  193.         <h4><span style="background-color:#addfff;">Matched Template: <xsl:value-of select="@match"/></span></h4>
  194.         <div><xsl:value-of select="./@doc:description"/></div>
  195.  
  196.         <xsl:if test="./xsl:param">
  197.             <h5><span style="background-color:#ff00ff;">Parameters</span></h5>
  198.         </xsl:if>
  199.         <ul>
  200.         <xsl:for-each select="xsl:param[not(@doc:private='yes')]">
  201.             <li><span style="background-color:#ff00ff;"><b><xsl:value-of select="@name"/>:</b></span>   <xsl:value-of select="@doc:description"/>
  202.             <xsl:choose>
  203.                 <xsl:when test="@select">
  204.                     <i>[default=<xsl:value-of select="@select"/>]</i>
  205.                 </xsl:when>
  206.                 <xsl:otherwise>
  207.                     <i>[default=<xsl:value-of select="."/>]</i>
  208.                 </xsl:otherwise>
  209.             </xsl:choose>
  210.             </li>
  211.         </xsl:for-each>
  212.         </ul>
  213.  
  214.         <xsl:if test="xsl:variable and doc:public='yes'">
  215.             <h5>Attributes</h5>
  216.             <ul>
  217.             <xsl:for-each select="xsl:variable[@doc:description]">
  218.                 <li><b><xsl:value-of select="@name"/>. </b> <xsl:value-of select="@doc:description"/>
  219.                 <xsl:if test="xsl:choose/xsl:otherwise">[<xsl:value-of select="@name"/>='<xsl:value-of select="."/>']</xsl:if>
  220.                 </li>
  221.             </xsl:for-each>
  222.             </ul>
  223.         </xsl:if>
  224.     </xsl:template>
  225.  
  226.     <xsl:template match="xsl:template[@mode and @doc:public='yes']">
  227.         <h4><span style="background-color:#addfff;">Modal Matched Template: <xsl:value-of select="@mode"/></span></h4>
  228.         <div><xsl:value-of select="./@doc:description"/></div>
  229.         <xsl:if test="xsl:variable and doc:public='yes'">
  230.             <h5>Attributes</h5>
  231.             <ul>
  232.             <xsl:for-each select="xsl:variable[@doc:description]">
  233.                 <li><b><xsl:value-of select="@name"/>. </b> <xsl:value-of select="@doc:description"/>
  234.                 <xsl:if test="xsl:choose/xsl:otherwise">[<xsl:value-of select="@name"/>='<xsl:value-of select="."/>']</xsl:if>
  235.                 </li>
  236.             </xsl:for-each>
  237.             </ul>
  238.         </xsl:if>
  239.     </xsl:template>
  240.  
  241.         
  242.     <xsl:template match="doc:example">
  243.         <h5>Example</h5>
  244.         <pre>
  245.         <xsl:copy-of select="*|@*|text()"/>
  246.         </pre>
  247.     </xsl:template>
  248.     
  249.     <xsl:template match="xsl:include">
  250.         <li>
  251.         <xsl:variable name="doc" select="document(@href)"/>
  252.         <xsl:variable name="import_id" select="generate-id()"/>
  253.         <div class="containedDocumentation" >
  254.         <h1 class="includeTitle"  onclick="showHideImportData('{$import_id}');" style="cursor:hand;">
  255.         <xsl:value-of select="@href"/>
  256.         </h1>
  257.         <div id="{$import_id}" style="display:none;">
  258.         <xsl:call-template name="displayPage">
  259.             <xsl:with-param name="stylesheet" select="$doc//xsl:stylesheet"/>
  260.         </xsl:call-template>
  261.         </div>
  262.         </div>
  263.         </li>
  264.     </xsl:template>
  265.     
  266.     <xsl:template match="xsl:import">
  267.         <li>
  268.         <xsl:variable name="doc" select="document(@href)"/>
  269.         <xsl:variable name="import_id" select="generate-id()"/>
  270.         <div class="containedDocumentation" >
  271.         <h1 class="importTitle"  onclick="showHideImportData('{$import_id}');" style="cursor:hand;">
  272.         <xsl:value-of select="@href"/>
  273.         </h1>
  274.         <div id="{$import_id}" style="display:none;">
  275.         <xsl:call-template name="displayPage">
  276.             <xsl:with-param name="stylesheet" select="$doc//xsl:stylesheet"/>
  277.         </xsl:call-template>
  278.         </div>
  279.         </div>
  280.         </li>
  281.     </xsl:template>
  282.  
  283.     <xsl:template name="outputDisplay" doc:public="no">
  284.         <xsl:param name="outputNodeCnd"/>
  285.         <xsl:param name="stylesheet"/>
  286.         <xsl:variable name="outputNode.tf">
  287.             <xsl:choose>
  288.                 <xsl:when test="$outputNodeCnd">
  289.                     <output>
  290.                         <xsl:for-each select="$outputNodeCnd/@*">
  291.                             <xsl:attribute name="{name(.)}">
  292.                                 <xsl:value-of select="."/>
  293.                             </xsl:attribute>
  294.                         </xsl:for-each>
  295.                     </output>
  296.                 </xsl:when>
  297.                 <xsl:otherwise> 
  298.                     <output/>
  299.                 </xsl:otherwise>
  300.             </xsl:choose>
  301.         </xsl:variable>
  302.         <xsl:if test="../output">
  303.             <h4>Output</h4>
  304.         </xsl:if>
  305.         <xsl:for-each select="$outputNodeCnd">
  306.             <ul>
  307.             <xsl:if test="not(@method)">
  308.                 <xsl:choose>
  309.                     <xsl:when test="$stylesheet//html|$stylesheet//HTML">
  310.                         <li><b>Method:</b> html (default)</li>
  311.                     </xsl:when>
  312.                     <xsl:otherwise>
  313.                         <li><b>Method:</b> xml (default)</li>
  314.                     </xsl:otherwise>
  315.                 </xsl:choose>
  316.             </xsl:if>
  317.             <xsl:if test="@method">
  318.                 <li><b>Method:</b> <xsl:value-of select="@method"/></li>
  319.             </xsl:if>
  320.             <xsl:if test="not(@media-type)">
  321.                 <li><b>Media-Type:</b> text/html (default)</li>        
  322.             </xsl:if>
  323.             <xsl:if test="@media-type">
  324.                 <li><b>Media-Type:</b> <xsl:value-of select="@media-type"/></li>
  325.             </xsl:if>
  326.             <xsl:if test="not(@indent)">
  327.                 <li><b>Indent:</b> No (default)</li>
  328.             </xsl:if>
  329.             <xsl:if test="@indent">
  330.                 <li><b>Indent:</b> <xsl:value-of select="@indent"/></li>
  331.             </xsl:if>
  332.             <xsl:if test="not(@version)">
  333.                 <li><b>Version:</b> <xsl:value-of select="$stylesheet/@version"/> (default)</li>
  334.             </xsl:if>
  335.             <xsl:if test="@version">
  336.                 <li><b>Version:</b> <xsl:value-of select="@version"/></li>
  337.             </xsl:if>
  338.             <xsl:if test="not(@omit-xml-declaration)">
  339.                 <li><b>XML Declaration Omitted:</b> No (default)</li>
  340.             </xsl:if>
  341.             <xsl:if test="@omit-xml-declaration">
  342.                 <li><b>XML Declaration Omitted:</b> <xsl:value-of select="@omit-xml-declaration"/></li>
  343.             </xsl:if>
  344.             <xsl:if test="not(@standalone)">
  345.                 <li><b>Stand Alone:</b> Either</li>
  346.             </xsl:if>
  347.             <xsl:if test="@standalone">
  348.                 <li><b>Stand Alone:</b> <xsl:value-of select="@standalone"/></li>
  349.             </xsl:if>
  350.             <xsl:if test="not(@encoding)">
  351.                 <li><b>Encoding:</b> UTF-16</li>
  352.             </xsl:if>
  353.             <xsl:if test="@encoding">
  354.                 <li><b>Encoding:</b> <xsl:value-of select="@encoding"/></li>
  355.             </xsl:if>
  356.             <xsl:if test="@doctype-system">
  357.                 <li><b>System Document Type:</b> <xsl:value-of select="@doctype-system"/></li>
  358.             </xsl:if>
  359.             <xsl:if test="@doctype-public">
  360.                 <li><b>Public Document Type:</b> <xsl:value-of select="@doctype-public"/></li>
  361.             </xsl:if>
  362.             <xsl:variable name="isIdentity">
  363.                 <xsl:choose>
  364.                 <xsl:when test="$stylesheet//xsl:template[@match='@*|node()' or @match='*|@*|text()' or @match='node()|@*']|$stylesheet//xsl:import[@href='identity.xsl']|xsl:include[@href='identity.xsl']">yes</xsl:when>
  365.                 <xsl:otherwise>no</xsl:otherwise>
  366.                 </xsl:choose>
  367.             </xsl:variable>
  368.             <li><b>Is Identity Template:</b> <xsl:value-of select="$isIdentity"/></li>
  369.             <xsl:variable name="isExecutable">
  370.                 <xsl:choose>
  371.                 <xsl:when test="$stylesheet//xsl:template[@match='/']">yes</xsl:when>
  372.                 <xsl:otherwise>no <xsl:if test="$stylesheet//xsl:import|$stylesheet//xsl:import">*(though imported/included templates may be).</xsl:if>
  373. </xsl:otherwise>
  374.                 </xsl:choose>
  375.             </xsl:variable>
  376.             <li><b>Is Stylesheet Executable:</b> <xsl:value-of select="$isExecutable"/></li>
  377.             </ul>
  378.         </xsl:for-each>
  379.     </xsl:template>
  380.     
  381.     <xsl:template match="xsl:stylesheet/xsl:variable|xsl:stylesheet/xsl:param">
  382.             <li><b><xsl:value-of select="@name"/>. </b> <xsl:value-of select="@doc:description"/>
  383.             <xsl:if test="@select">
  384.             <i>[default=<xsl:value-of select="@select"/>]</i>
  385.             </xsl:if>
  386.             </li>
  387.     </xsl:template>
  388. </xsl:stylesheet>