home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 October / pcp156b.iso / alphawrk / TEXML / TEXML.ZIP / com / ibm / texml / XMLSpecTeX.xsl < prev   
Encoding:
Extensible Markup Language  |  1999-05-18  |  19.0 KB  |  746 lines

  1. <?xml version="1.0" encoding="ISO-8859-1" ?>
  2. <!-- xslspec.xsl 1.3 99/01/11 SMI; Style Sheet for the XML and XSL Recommendations and Working Drafts; written by Eduardo Gutentag -->
  3. <!-- xmlspec.xsl 1.5 1999/04/17 04:13:52 jjc Exp $ Hacked by James Clark -->
  4. <!-- $Id:$ Modified to output TeXML -->
  5. <!-- XSL Style sheet, DTD omitted -->
  6. <xsl:stylesheet
  7.   xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
  8.   resultns="">
  9.  
  10. <!--
  11. +++++++++++++++++++++++++
  12.  
  13. Inclusions
  14.  
  15. +++++++++++++++++++++++++
  16. -->
  17.  
  18. <xsl:template match="/">
  19.   <xsl:apply-templates match="spec"/>
  20. </xsl:template>
  21.  
  22. <!--
  23. *******************************************************************
  24.  
  25. Basic framework to format W3C specs (as in the XML spec)
  26.  
  27. *******************************************************************
  28. -->
  29.   <xsl:template match="spec">
  30.     <TeXML>
  31.     <cmd name="documentclass">
  32.       <parm>article</parm>
  33.     </cmd>
  34.     <cmd name="title">
  35.       <parm>
  36.         <xsl:value-of select="header/title"/>
  37.         <xsl:value-of select="header/version"/>
  38.       </parm>
  39.     </cmd>
  40.     <cmd name="author">
  41.       <parm>
  42.         <xsl:value-of select="w3c-doctype"/>
  43.         <xsl:text> </xsl:text>
  44.         <xsl:value-of select="pubdate/day"/>
  45.         <xsl:text> </xsl:text>
  46.         <xsl:value-of select="pubdate/month"/>
  47.         <xsl:text> </xsl:text>
  48.         <xsl:value-of select="pubdate/year"/>
  49.       </parm>
  50.     </cmd>
  51.     <env name="document">
  52.       <cmd name="maketitle"/>
  53.       <xsl:apply-templates/>
  54.     </env>
  55.     </TeXML>
  56.   </xsl:template>
  57.  
  58. <!--
  59. *******************************************************************
  60.  
  61. Prologue
  62.  
  63. *******************************************************************
  64. -->
  65.  
  66.   <xsl:template match="header">
  67.     <xsl:apply-templates select="publoc"/>
  68.     <xsl:apply-templates select="latestloc"/>
  69.     <xsl:apply-templates select="prevlocs"/>
  70.     <xsl:apply-templates select="authlist"/>
  71.     <xsl:call-template name="copyright"/>
  72.     <xsl:apply-templates select="abstract"/>
  73.     <xsl:apply-templates select="status"/>
  74.   </xsl:template>
  75.  
  76.   <xsl:template match="publoc">
  77.     <cmd name="section*"><parm>This version:</parm></cmd>
  78.     <env name="itemize">
  79.     <xsl:apply-templates/>
  80.     </env>
  81.   </xsl:template>
  82.  
  83.   <xsl:template match="publoc/loc" priority="1">
  84.     <cmd name="item"/><xsl:apply-templates/>
  85.   </xsl:template>
  86.  
  87.   <xsl:template match="latestloc">
  88.     <cmd name="section*"><parm>Latest version:</parm></cmd>
  89.     <xsl:apply-templates/>
  90.   </xsl:template>
  91.  
  92.   <xsl:template match="prevlocs">
  93.     <cmd name="section*"><parm>Previous versions:</parm></cmd>
  94.     <xsl:apply-templates/>
  95.   </xsl:template>
  96.  
  97.   <xsl:template match="authlist">
  98.     <cmd name="section*">
  99.       <parm>
  100.       <xsl:text>Editor</xsl:text>
  101.       <xsl:if test="count(author)>1">s</xsl:if>
  102.       <xsl:text>:</xsl:text>
  103.       </parm>
  104.     </cmd>
  105.     <xsl:choose>
  106.       <xsl:when test="count(author)>1">
  107.         <env name="itemize">
  108.         <xsl:apply-templates mode="authors"/>
  109.         </env>
  110.       </xsl:when>
  111.       <xsl:otherwise>
  112.         <xsl:apply-templates mode="author"/>
  113.       </xsl:otherwise>
  114.     </xsl:choose>
  115.   </xsl:template>
  116.  
  117.   <xsl:template match="author" mode="authors">
  118.     <cmd name="item"/><xsl:apply-templates mode=""/>
  119.   </xsl:template>
  120.  
  121.   <xsl:template match="author" mode="author">
  122.     <xsl:apply-templates mode=""/>
  123.   </xsl:template>
  124.  
  125.   <xsl:template match="author/name">
  126.     <xsl:apply-templates/>
  127.   </xsl:template>
  128.  
  129.   <xsl:template match="author/affiliation">
  130.     <xsl:text>, </xsl:text>
  131.     <xsl:apply-templates/>
  132.   </xsl:template>
  133.  
  134.   <xsl:template match="author/email">
  135.     <cmd name="textit">
  136.       <parm>
  137.         <xsl:apply-templates/>
  138.       </parm>
  139.     </cmd>
  140.   </xsl:template>
  141.  
  142.   <xsl:template match="abstract">
  143.     <cmd name="section*"><parm>Abstract</parm></cmd>
  144.     <xsl:apply-templates/>
  145.   </xsl:template>
  146.  
  147.   <xsl:template match="status">
  148.     <cmd name="section*"><parm>Status of this document</parm></cmd>
  149.     <xsl:apply-templates/>
  150.   </xsl:template>
  151.  
  152. <!--
  153. *******************************************************************
  154.  
  155. Real body work
  156.  
  157. *******************************************************************
  158. -->
  159.  
  160.   <xsl:template match="body">
  161.     <cmd name="section*"><parm>Table of contents</parm></cmd>
  162.     <xsl:call-template name="toc"/>
  163.     <xsl:apply-templates/>
  164.   </xsl:template>
  165.  
  166.   <xsl:template match="back">
  167.     <xsl:apply-templates/>
  168.   </xsl:template>
  169.  
  170.   <!-- This is a rather perverse way of dealing with the divs (should
  171.      apply-templates in the div, then have a template rule for each
  172.      div/head) but it's a good way of playing with modes...
  173.   -->
  174.   <xsl:template match="div1|inform-div1">
  175.     <cmd name="part*">
  176.       <parm>
  177.       <xsl:choose>
  178.       <xsl:when test="from-ancestors(back)">
  179.         <xsl:number format="A. "
  180.           count="div1|inform-div1"/>
  181.       </xsl:when>
  182.       <xsl:when test="from-ancestors(body)">
  183.         <xsl:number format="1. "/>
  184.       </xsl:when>
  185.       </xsl:choose>
  186.       <xsl:apply-templates select="head" mode="header"/>
  187.       </parm>
  188.     </cmd>
  189.     <xsl:apply-templates/>
  190.   </xsl:template>
  191.  
  192.   <xsl:template match="div2">
  193.     <cmd name="section*">
  194.       <parm>
  195.       <xsl:choose>
  196.       <xsl:when test="from-ancestors(back)">
  197.         <xsl:number
  198.           level="multi"
  199.           count="inform-div1|div1|div2"
  200.           format="A.1 "/>
  201.       </xsl:when>
  202.       <xsl:when test="from-ancestors(body)">
  203.         <xsl:number
  204.           level="multi"
  205.           count="div1|div2"
  206.           format="1.1 "/>
  207.       </xsl:when>
  208.       </xsl:choose>
  209.       <xsl:apply-templates select="head" mode="header"/>
  210.       </parm>
  211.     </cmd>
  212.     <xsl:apply-templates/>
  213.   </xsl:template>
  214.  
  215.   <xsl:template match="div3">
  216.     <cmd name="subsection*">
  217.       <parm>
  218.       <xsl:choose>
  219.       <xsl:when test="from-ancestors(back)">
  220.         <xsl:number
  221.           level="multi"
  222.           count="inform-div1|div1|div2|div3"
  223.           format="A.1 "/>
  224.       </xsl:when>
  225.       <xsl:when test="from-ancestors(body)">
  226.         <xsl:number
  227.           level="multi"
  228.           count="div1|div2|div3"
  229.           format="1.1 "/>
  230.       </xsl:when>
  231.       </xsl:choose>
  232.       <xsl:apply-templates select="head" mode="header"/>
  233.       </parm>
  234.     </cmd>
  235.     <xsl:apply-templates/>
  236.   </xsl:template>
  237.  
  238.   <xsl:template match="div4">
  239.     <cmd name="subsubsection">
  240.       <parm>
  241.         <xsl:choose>
  242.         <xsl:when test="from-ancestors(back)">
  243.           <xsl:number
  244.             level="multi"
  245.             count="inform-div1|div1|div2|div3|div4"
  246.             format="A.1.1 "/>
  247.         </xsl:when>
  248.         <xsl:when test="from-ancestors(body)">
  249.           <xsl:number
  250.             level="multi"
  251.             count="div1|div2|div3|div4"
  252.             format="1.1.1 "/>
  253.         </xsl:when>
  254.         </xsl:choose>
  255.         <xsl:apply-templates select="head" mode="header"/>
  256.       </parm>
  257.     </cmd>
  258.     <xsl:apply-templates/>
  259.   </xsl:template>
  260.  
  261.   <xsl:template match="head" priority="1">
  262.   </xsl:template>
  263.  
  264.   <xsl:template match="head" mode="header">
  265.   <xsl:apply-templates/>
  266.   </xsl:template>
  267.  
  268. <!--
  269. *******************************************************************
  270.  
  271. Blocks
  272.  
  273. *******************************************************************
  274. -->
  275.   <xsl:template match="item/p" priority="1">
  276.     <xsl:apply-templates/>
  277.     <cmd name="par"/>
  278.   </xsl:template>
  279.  
  280.   <xsl:template match="p">
  281.     <xsl:apply-templates/>
  282.     <cmd name="par"/>
  283.   </xsl:template>
  284.  
  285.   <xsl:template match="eg">
  286.     <env name="verbatim"><verb>
  287.       <xsl:apply-templates/>
  288.     </verb></env>
  289.   </xsl:template>
  290.  
  291.   <xsl:template match="ednote">
  292.     <env name="quote">
  293.       <cmd name="textbf"><parm>Ed. Note: </parm></cmd>
  294.       <xsl:apply-templates/>
  295.     </env>
  296.   </xsl:template>
  297.  
  298.   <xsl:template match="edtext">
  299.     <xsl:apply-templates/>
  300.   </xsl:template>
  301.  
  302.   <xsl:template match="issue">
  303.     <env name="quote">
  304.       <cmd name="textbf"><parm>Issue (<xsl:value-of select="substring-after(@id,'-')"/>): </parm></cmd>
  305.       <xsl:apply-templates/>
  306.     </env>
  307.   </xsl:template>
  308.  
  309.   <xsl:template match="note">
  310.     <env name="quote">
  311.       <cmd name="textbf"><parm>NOTE: </parm></cmd>
  312.       <xsl:apply-templates/>
  313.     </env>
  314.   </xsl:template>
  315.  
  316.   <xsl:template match="issue/p|note/p">
  317.     <xsl:apply-templates/>
  318.   </xsl:template>
  319.  
  320. <!--
  321. *******************************************************************
  322.  
  323. Productions
  324.  
  325. *******************************************************************
  326. -->
  327.   <xsl:template match="scrap">
  328.     <xsl:if test="string(head)">
  329.       <cmd name="textbf"><parm><xsl:value-of select="head"/></parm></cmd>
  330.     </xsl:if>
  331.     <cmd name="par"/>
  332.     <env name="tabular">
  333.       <group>lllll</group>
  334.       <cmd name="noalign"><parm><cmd name="hrule"/></parm></cmd>
  335.       <xsl:apply-templates select="prodgroup|prod"/>
  336.       <cmd name="noalign"><parm><cmd name="hrule"/></parm></cmd>
  337.     </env>
  338.   </xsl:template>
  339.  
  340.   <xsl:template match="prod">
  341.       <!-- select elements that start a row -->
  342.       <xsl:apply-templates select="
  343. *[from-self(lhs)
  344.   or ((from-self(vc) or from-self(wfc) or from-self(com))
  345.       and not(from-preceding-siblings(*[1][from-self(rhs)])))
  346.   or (from-self(rhs)
  347.       and not(from-preceding-siblings(*[1][from-self(lhs)])))]
  348. "/>
  349.   </xsl:template>
  350.  
  351.   <xsl:template match="lhs">
  352.     <xsl:number from="body" level="any" format="[1]"/>
  353.     <spec cat="align"/>
  354.     <xsl:apply-templates/>
  355.     <spec cat="align"/>
  356.     <xsl:text>::=</xsl:text>
  357.     <spec cat="align"/>
  358.     <xsl:for-each select="from-following-siblings(*[1])">
  359.       <xsl:apply-templates mode="cell" select="."/>
  360.       <spec cat="align"/>
  361.       <xsl:apply-templates mode="cell" select="from-following-siblings(*[1][from-self(vc) or from-self(wfc) or from-self(com)])"/>
  362.     </xsl:for-each>
  363.     <cmd name="cr"/>
  364.   </xsl:template>
  365.  
  366.   <xsl:template match="rhs">
  367.     <spec cat="align"/>
  368.     <spec cat="align"/>
  369.     <spec cat="align"/>
  370.     <xsl:apply-templates mode="cell" select="."/>
  371.     <spec cat="align"/>
  372.     <xsl:apply-templates mode="cell" select="from-following-siblings(*[1][from-self(vc) or from-self(wfc) or from-self(com)])"/>
  373.     <cmd name="cr"/>
  374.   </xsl:template>
  375.  
  376.   <xsl:template match="vc|wfc|com">
  377.     <spec cat="align"/>
  378.     <spec cat="align"/>
  379.     <spec cat="align"/>
  380.     <spec cat="align"/>
  381.     <xsl:apply-templates mode="cell" select="."/>
  382.     <cmd name="cr"/>
  383.   </xsl:template>
  384.  
  385.   <xsl:template match="prodgroup">
  386.     <xsl:apply-templates/>
  387.   </xsl:template>
  388.  
  389.   <xsl:template match="com" mode="cell">
  390.     <xsl:text>/*</xsl:text>
  391.     <xsl:apply-templates/>
  392.     <xsl:text>*/</xsl:text>
  393.   </xsl:template>
  394.  
  395.   <xsl:template match="rhs" mode="cell">
  396.     <xsl:apply-templates/>
  397.   </xsl:template>
  398.  
  399.   <xsl:template match="vc" mode="cell">
  400.     <xsl:text>[VC: </xsl:text>
  401.     <xsl:value-of select="id(@def)/head"/>
  402.     <xsl:text> ]</xsl:text>
  403.     <xsl:apply-templates/>
  404.   </xsl:template>
  405.  
  406.   <xsl:template match="wfc" mode="cell">
  407.     <xsl:text>[WFC: </xsl:text>
  408.     <xsl:value-of select="id(@def)/head"/>
  409.     <xsl:text>]</xsl:text>
  410.     <xsl:apply-templates/>
  411.   </xsl:template>
  412.  
  413. <!--
  414. *******************************************************************
  415.  
  416. References
  417.  
  418. *******************************************************************
  419. -->
  420.   <xsl:template match="p/loc" priority="1">
  421.     <xsl:apply-templates/>
  422.   </xsl:template>
  423.  
  424.   <xsl:template match="loc">
  425.     <xsl:apply-templates/>
  426.     <cmd name="par"/>
  427.   </xsl:template>
  428.  
  429.   <xsl:template match="bibref">
  430.     <xsl:text>[</xsl:text>
  431.     <xsl:value-of select="id(@ref)/@key"/>
  432.     <xsl:apply-templates/>
  433.     <xsl:text>]</xsl:text>
  434.   </xsl:template>
  435.  
  436.   <xsl:template match="specref">
  437.     <xsl:text>[</xsl:text>
  438.     <cmd name="textbf">
  439.       <parm>
  440.         <xsl:for-each select="id(@ref)/head">
  441.           <xsl:choose>
  442.           <xsl:when test="from-ancestors(back)">
  443.             <xsl:number
  444.               level="multi"
  445.               count="inform-div1|div1|div2|div3|div4"
  446.               format="A.1 "/>
  447.           </xsl:when>
  448.           <xsl:when test="from-ancestors(body)">
  449.             <xsl:number
  450.               level="multi"
  451.               count="div1|div2|div3|div4"
  452.               format="1.1 "/>
  453.           </xsl:when>
  454.           </xsl:choose>
  455.           <xsl:apply-templates/>
  456.         </xsl:for-each>
  457.       </parm>
  458.     </cmd>
  459.     <xsl:apply-templates/>
  460.     <xsl:text>]</xsl:text>
  461.   </xsl:template>
  462.  
  463.   <xsl:template match="termref">
  464.     <xsl:apply-templates/>
  465.   </xsl:template>
  466.  
  467.   <xsl:template match="titleref">
  468.     <xsl:apply-templates/>
  469.   </xsl:template>
  470.  
  471.   <xsl:template match="termdef">
  472.     <xsl:apply-templates/>
  473.   </xsl:template>
  474.  
  475.   <xsl:template match="vcnote">
  476.     <cmd name="textbf">
  477.       <parm>Validity Constraint: <xsl:value-of select="head"/></parm>
  478.     </cmd>
  479.     <xsl:apply-templates/>
  480.   </xsl:template>
  481.  
  482.   <xsl:template match="wfcnote">
  483.     <cmd name="textbf">
  484.       <parm>Well Formedness Constraint: <xsl:value-of select="head"/></parm>
  485.     </cmd>
  486.     <xsl:apply-templates/>
  487.   </xsl:template>
  488.  
  489. <!--
  490. *******************************************************************
  491.  
  492. Inlines
  493.  
  494. *******************************************************************
  495. -->
  496.   <xsl:template match="termdef">
  497.     <xsl:apply-templates/>
  498.   </xsl:template>
  499.  
  500.   <xsl:template match="term">
  501.     <cmd name="textbf"><parm><xsl:apply-templates/></parm></cmd>
  502.   </xsl:template>
  503.  
  504.   <xsl:template match="orglist/member[1]" priority="2">
  505.     <xsl:apply-templates select="*"/>
  506.   </xsl:template>
  507.  
  508.   <xsl:template match="orglist/member">
  509.     <xsl:text>; </xsl:text>
  510.     <xsl:apply-templates select="*"/>
  511.   </xsl:template>
  512.  
  513.   <xsl:template match="orglist/member/affiliation">
  514.      <xsl:text>, </xsl:text>
  515.      <xsl:apply-templates/>
  516.   </xsl:template>
  517.  
  518.   <xsl:template match="orglist/member/role">
  519.      <xsl:text> (</xsl:text>
  520.      <xsl:apply-templates/>
  521.      <xsl:text>)</xsl:text>
  522.   </xsl:template>
  523.  
  524.   <xsl:template match="code">
  525.     <cmd name="texttt">
  526.       <parm>
  527.         <xsl:apply-templates/>
  528.       </parm>
  529.     </cmd>
  530.   </xsl:template>
  531.  
  532.   <xsl:template match="emph">
  533.     <cmd name="textit"><parm><xsl:apply-templates/></parm></cmd>
  534.   </xsl:template>
  535.  
  536. <!--
  537. *******************************************************************
  538.  
  539. Lists
  540.  
  541. *******************************************************************
  542. -->
  543.   <xsl:template match="blist">
  544.   <env name="description">
  545.     <xsl:apply-templates/>
  546.   </env>
  547.   </xsl:template>
  548.  
  549.   <xsl:template match="slist">
  550.   <env name="itemize">
  551.     <xsl:apply-templates/>
  552.   </env>
  553.   </xsl:template>
  554.  
  555.   <xsl:template match="sitem">
  556.     <cmd name="item"/>
  557.     <xsl:apply-templates/>
  558.   </xsl:template>
  559.  
  560.   <xsl:template match="blist/bibl">
  561.     <cmd name="item">
  562.       <opt>
  563.       <xsl:value-of select="@key"/>
  564.       </opt>
  565.     </cmd>
  566.     <xsl:apply-templates/>
  567.   </xsl:template>
  568.  
  569.   <xsl:template match="olist">
  570.   <env name="enumerate">
  571.     <xsl:apply-templates/>
  572.   </env>
  573.   </xsl:template>
  574.  
  575.   <xsl:template match="ulist">
  576.   <env name="itemize">
  577.     <xsl:apply-templates/>
  578.   </env>
  579.   </xsl:template>
  580.  
  581.   <xsl:template match="glist">
  582.   <env name="description">
  583.     <xsl:apply-templates/>
  584.   </env>
  585.   </xsl:template>
  586.  
  587.   <xsl:template match="item">
  588.   <cmd name="item"/>
  589.     <xsl:apply-templates/>
  590.   </xsl:template>
  591.  
  592.   <xsl:template match="label">
  593.   <cmd name="item">
  594.     <opt>
  595.     <cmd name="textbf"><parm><xsl:apply-templates/></parm></cmd>
  596.     </opt>
  597.   </cmd>
  598.   </xsl:template>
  599.  
  600.   <xsl:template match="def">
  601.     <xsl:apply-templates/>
  602.   </xsl:template>
  603.  
  604.   <xsl:template match="orglist">
  605.     <xsl:apply-templates select="*"/>
  606.   </xsl:template>
  607.  
  608.   <xsl:template match="olist">
  609.   <env name="enumerate">
  610.     <xsl:apply-templates/>
  611.   </env>
  612.   </xsl:template>
  613.  
  614.  
  615. <!--
  616. *******************************************************************
  617.  
  618. Empty templates
  619.  
  620. *******************************************************************
  621. -->
  622.   <xsl:template match="w3c-designation">
  623.   </xsl:template>
  624.  
  625.   <xsl:template match="w3c-doctype">
  626.   </xsl:template>
  627.  
  628.   <xsl:template match="header/pubdate">
  629.   </xsl:template>
  630.  
  631.   <xsl:template match="spec/header/title">
  632.   </xsl:template>
  633.  
  634.   <xsl:template match="revisiondesc">
  635.   </xsl:template>
  636.  
  637.   <xsl:template match="pubstmt">
  638.   </xsl:template>
  639.  
  640.   <xsl:template match="sourcedesc">
  641.   </xsl:template>
  642.  
  643.   <xsl:template match="langusage">
  644.   </xsl:template>
  645.  
  646.   <xsl:template match="version">
  647.   </xsl:template>
  648.  
  649. <!--
  650. *******************************************************************
  651.  
  652. Macros
  653.  
  654.  
  655. *******************************************************************
  656. -->
  657.  
  658.   <xsl:template name="copyright">
  659.     Copyright (c) 1998 W3C
  660.     (MIT, INRIA, Keio), All Rights Reserved. W3C
  661.     <cmd name="par"/>
  662.   </xsl:template>
  663.  
  664.   <xsl:template name="toc">
  665.     <env name="tabbing">
  666.       <cmd name="vrule"/> width 0.375in <ctrl ch="="/>
  667.       <cmd name="vrule"/> width 0.375in <ctrl ch="="/>
  668.       <cmd name="kill"/>
  669.       <xsl:for-each select="/spec/body/div1">
  670.         <xsl:number format="1. "/>
  671.         <xsl:call-template name="makeref"/>
  672.         <ctrl ch="\"/>
  673.  
  674.         <xsl:for-each select="div2">
  675.           <ctrl ch=">"/>
  676.           <xsl:number
  677.             level="multi"
  678.             count="div1|div2"
  679.             format="1.1 "/>
  680.             <xsl:call-template name="makeref"/>
  681.           <ctrl ch="\"/>
  682.             <xsl:for-each select="div3">
  683.               <ctrl ch=">"/>
  684.               <ctrl ch=">"/>
  685.               <xsl:number
  686.                 level="multi"
  687.                 count="div1|div2|div3"
  688.                 format="1.1 "/>
  689.                 <xsl:call-template name="makeref"/>
  690.               <ctrl ch="\"/>
  691.             </xsl:for-each>
  692.         </xsl:for-each>
  693.       </xsl:for-each>
  694.  
  695.       <cmd name="textbf"><parm>Appendices</parm></cmd>
  696.  
  697.       <xsl:for-each select="/spec/back/div1 | /spec/back/inform-div1">
  698.         <xsl:number format="A. "
  699.           count="div1|inform-div1"/>
  700.         <xsl:call-template name="makeref"/>
  701.         <ctrl ch="\"/>
  702.  
  703.         <xsl:for-each select="div2">
  704.           <ctrl ch=">"/>
  705.           <xsl:number
  706.             level="multi"
  707.             count="div1|div2"
  708.             format="A.1 "/>
  709.             <xsl:call-template name="makeref"/>
  710.           <ctrl ch="\"/>
  711.  
  712.           <xsl:for-each select="div3">
  713.             <ctrl ch=">"/>
  714.             <ctrl ch=">"/>
  715.             <xsl:number
  716.               level="multi"
  717.               count="div1|div2|div3"
  718.               format="A.1 "/>
  719.               <xsl:call-template name="makeref"/>
  720.             <ctrl ch="\"/>
  721.           </xsl:for-each>
  722.         </xsl:for-each>
  723.       </xsl:for-each>
  724.     </env>
  725.   </xsl:template>
  726.  
  727.   <xsl:template name="makeref">
  728.     <xsl:value-of select="head"/>
  729.   </xsl:template>
  730.  
  731.   <xsl:template name="nt">
  732.     <xsl:apply-templates/>
  733.   </xsl:template>
  734.  
  735.   <xsl:template name="xnt">
  736.     <xsl:apply-templates/>
  737.   </xsl:template>
  738.  
  739.   <xsl:template match="quote">
  740.     <xsl:text>``</xsl:text>
  741.     <xsl:apply-templates/>
  742.     <xsl:text>''</xsl:text>
  743.   </xsl:template>
  744.  
  745. </xsl:stylesheet>
  746.