/[volute]/trunk/projects/vocabularies/doc/structure.xslt
ViewVC logotype

Diff of /trunk/projects/vocabularies/doc/structure.xslt

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 713 by norman.x.gray, Mon Jul 21 12:24:28 2008 UTC revision 714 by norman.x.gray, Wed Aug 6 20:02:09 2008 UTC
# Line 3  Line 3 
3                version="1.0"                version="1.0"
4                exclude-result-prefixes="h"                exclude-result-prefixes="h"
5                xmlns:h="http://www.w3.org/1999/xhtml"                xmlns:h="http://www.w3.org/1999/xhtml"
6                  xmlns="http://www.w3.org/1999/xhtml"
7                xmlns:dc="http://purl.org/dc/elements/1.1/"                xmlns:dc="http://purl.org/dc/elements/1.1/"
8                xmlns:dcterms="http://purl.org/dc/terms/">                xmlns:dcterms="http://purl.org/dc/terms/">
9    
10    <x:output method="xml"    <x:output method="xml"
11              encoding="UTF-8"              encoding="UTF-8"
12              version="1.0"              version="1.0"/>
             doctype-public="-//W3C//DTD XHTML+RDFa 1.0//EN"  
             doctype-system="http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"  
             omit-xml-declaration="yes"/>  
   
   <!-- This namespace-alias appears to terminally confuse libxslt 10111,  
        causing it to spin its wheels endlessly when processing the  
        <h:html> element, though bizarrely not any children of it  
        (libxslt 10122 is OK, though).  
        I can't remember why it's here, and it seems redundant,  
        but I'd probably best leave it here until it becomes definitely  
        redundant, or explicably necessary. -->  
   <!--<x:namespace-alias stylesheet-prefix="h" result-prefix="#default"/>-->  
   
   <!-- In the templates below, there are numerous references to <x:element>,  
        adding elements in the xhtml namespage.  These should be replaceable  
        by simple h:blah elements, but doing so appears to confuse at least  
        one XSLT processor (I think libxslt 10111). -->  
13    
14    <!-- We include support for RDFa in the following, via: the output doctype,    <!-- We include support for RDFa in the following, via: the output doctype,
15         the 'profile' attribute in the head element, and the various 'property'         the 'profile' attribute in the head element, and the various 'property'
# Line 62  Line 47 
47    </x:template>    </x:template>
48    
49    <!-- Add the GRDDL transformation magic attribute to the HTML element -->    <!-- Add the GRDDL transformation magic attribute to the HTML element -->
50    <x:template xmlns:grddl="http://www.w3.org/2003/g/data-view#" match="h:html">    <x:template match="h:html" xmlns:grddl="http://www.w3.org/2003/g/data-view#">
51      <x:copy>      <html grddl:transformation='http://ns.inria.fr/grddl/rdfa/2007/05/25/RDFa2RDFXML.xsl'>
       <x:attribute name="grddl:transformation"  
           >http://ns.inria.fr/grddl/rdfa/2007/05/25/RDFa2RDFXML.xsl</x:attribute>  
52        <x:apply-templates/>        <x:apply-templates/>
53      </x:copy>      </html>
54    </x:template>    </x:template>
55    
56    <x:template match="h:head">    <x:template match="h:head">
57      <x:copy>      <head profile='http://www.w3.org/1999/xhtml/vocab'>
       <x:attribute name='profile'>http://www.w3.org/1999/xhtml/vocab</x:attribute>  
58        <x:apply-templates select="@*"/>        <x:apply-templates select="@*"/>
59        <x:copy-of select="namespace::*[.='http://purl.org/dc/elements/1.1/']"/>        <x:copy-of select="namespace::*[.='http://purl.org/dc/elements/1.1/']"/>
60        <x:choose>        <x:choose>
# Line 81  Line 63 
63            <x:apply-templates select="h:link[@rel='stylesheet']"/>            <x:apply-templates select="h:link[@rel='stylesheet']"/>
64          </x:when>          </x:when>
65          <x:otherwise>          <x:otherwise>
66            <x:element name='link' namespace='http://www.w3.org/1999/xhtml'>            <link rel="stylesheet" type="text/css" href="/style/base.css"/>
             <x:attribute name='rel'>stylesheet</x:attribute>  
             <x:attribute name='type'>text/css</x:attribute>  
             <x:attribute name='href'>/style/base.css</x:attribute>  
           </x:element>  
           <!--h:link rel="stylesheet" type="text/css" href="/style/base.css"/-->  
67          </x:otherwise>          </x:otherwise>
68        </x:choose>        </x:choose>
69        <x:apply-templates select="h:title|h:meta|h:style"/>        <x:apply-templates select="h:title|h:meta|h:style"/>
70      </x:copy>      </head>
71    </x:template>    </x:template>
72    
73    
74      <x:template match="h:div[@class='section' or @class='section-nonum']">
75        <x:variable name='id'>
76          <x:call-template name='make-section-id'/>
77        </x:variable>
78        <x:variable name="level">
79          <x:choose>
80            <x:when test="ancestor::h:div[@class='section']/ancestor::h:div[@class='section']">h4</x:when>
81            <x:when test="ancestor::h:div[@class='section']">h3</x:when>
82            <x:otherwise>h2</x:otherwise>
83          </x:choose>
84        </x:variable>
85        <x:element name='{$level}'>
86          <a name='{$id}'><x:apply-templates select='.' mode='make-section-name'/></a>
87        </x:element>
88        <x:apply-templates/>
89      </x:template>
90      <!--
91    <x:template match="h:div[@class='section' or @class='section-nonum']">    <x:template match="h:div[@class='section' or @class='section-nonum']">
92      <x:variable name="id">      <x:variable name="id">
93        <x:call-template name="make-section-id"/>        <x:call-template name="make-section-id"/>
# Line 112  Line 107 
107        <x:element name='a' namespace='http://www.w3.org/1999/xhtml'>        <x:element name='a' namespace='http://www.w3.org/1999/xhtml'>
108          <x:attribute name='name'><x:value-of select='$id'/></x:attribute>          <x:attribute name='name'><x:value-of select='$id'/></x:attribute>
109          <x:if test="@id">          <x:if test="@id">
           <!-- If the id attribute is present, then add the  
                [link here] text, providing a link for this section -->  
110            <x:attribute name='href'>#<x:value-of select='$id'/></x:attribute>            <x:attribute name='href'>#<x:value-of select='$id'/></x:attribute>
111            <x:text> [link here]</x:text>            <x:text> [link here]</x:text>
112          </x:if>          </x:if>
113        </x:element>        </x:element>
114      </x:element>      </x:element>
 <!--  
     <x:element name="{$level}" namespace='http://www.w3.org/1999/xhtml'>  
       <x:attribute name='class'>hlink</x:attribute>  
       <x:element name="a" namespace='http://www.w3.org/1999/xhtml'>  
         <x:attribute name='name'><x:value-of select='$id'/></x:attribute>  
         <x:apply-templates select="." mode="make-section-name"/>  
       </x:element>  
       <x:element name='a' namespace='http://www.w3.org/1999/xhtml'>  
         <x:attribute name='href'>#<x:value-of select='$id'/></x:attribute>  
         <x:text> [link here]</x:text>  
       </x:element>  
     </x:element>  
 -->  
115      <x:apply-templates/>      <x:apply-templates/>
116    </x:template>    </x:template>
117      -->
118    
119    <x:template match="h:p[@class='title']"/>    <x:template match="h:p[@class='title']"/>
120    
121    <x:template match="h:div[@class='appendices']">    <x:template match="h:div[@class='appendices']">
122      <x:element name='h2' namespace='http://www.w3.org/1999/xhtml'>Appendices</x:element>      <h2>Appendices</h2>
123      <x:apply-templates/>      <x:apply-templates/>
124    </x:template>    </x:template>
125    
# Line 146  Line 127 
127      <x:variable name="id">      <x:variable name="id">
128        <x:call-template name="make-section-id"/>        <x:call-template name="make-section-id"/>
129      </x:variable>      </x:variable>
130      <x:element name='li' namespace='http://www.w3.org/1999/xhtml'>      <li>
131        <x:element name='a' namespace='http://www.w3.org/1999/xhtml'>        <a href='#{$id}'>
132          <x:attribute name='href'>#<x:value-of select='$id'/></x:attribute>          <x:apply-templates select='.' mode='make-section-name'/>
133          <x:apply-templates select="." mode="make-section-name"/>        </a>
       </x:element>  
134        <x:if test="h:div[@class='section' or @class='section-nonum']">        <x:if test="h:div[@class='section' or @class='section-nonum']">
135          <x:element name='ul' namespace='http://www.w3.org/1999/xhtml'>          <ul>
136            <x:apply-templates select="h:div[@class='section' or @class='section-nonum']" mode="make-toc"/>            <x:apply-templates select="h:div[@class='section' or @class='section-nonum']" mode="make-toc"/>
137          </x:element>          </ul>
138        </x:if>        </x:if>
139      </x:element>      </li>
140    </x:template>    </x:template>
141    
142    <x:template match="processing-instruction('toc')">    <x:template match="processing-instruction('toc')">
143      <x:element name='div' namespace='http://www.w3.org/1999/xhtml'>      <div id='toc' class='toc'>
144        <x:attribute name='id'>toc</x:attribute>        <ul>
       <x:attribute name='class'>toc</x:attribute>  
       <x:element name='ul' namespace='http://www.w3.org/1999/xhtml'>  
145          <x:apply-templates select="//h:body/h:div[@class='section' or @class='section-nonum']|//h:body/h:div[@class='appendices']/h:div" mode="make-toc"/>          <x:apply-templates select="//h:body/h:div[@class='section' or @class='section-nonum']|//h:body/h:div[@class='appendices']/h:div" mode="make-toc"/>
146        </x:element>        </ul>
147      </x:element>      </div>
148    </x:template>    </x:template>
149    
150    <x:template name="make-section-id">    <x:template name="make-section-id">
# Line 200  Line 178 
178    </x:template>    </x:template>
179    
180    <x:template match="h:span[@class='cite']">    <x:template match="h:span[@class='cite']">
181      <x:element name='em' namespace='http://www.w3.org/1999/xhtml'>      <em>[<a href='#ref:{text()}'><x:value-of select='.'/></a>]</em>
       <x:text>[</x:text>  
       <x:element name='a' namespace='http://www.w3.org/1999/xhtml'>  
         <x:attribute name="href">#ref:<x:value-of select="."/></x:attribute>  
         <x:value-of select="."/>  
       </x:element>  
       <x:text>]</x:text>  
     </x:element>  
182    </x:template>    </x:template>
183    
184    <x:template match="h:span[@class='url']">    <x:template match="h:span[@class='url']">
185      <x:element name='a' namespace='http://www.w3.org/1999/xhtml'>      <a href='{text()}'>
186        <x:attribute name='href'><x:value-of select='.'/></x:attribute>        <span class='url'><x:value-of select='.'/></span>
187        <x:element name='span' namespace='http://www.w3.org/1999/xhtml'>      </a>
         <x:attribute name='class'>url</x:attribute>  
         <x:value-of select="."/>  
       </x:element>  
     </x:element>  
188    </x:template>    </x:template>
189    
190    <x:template match="processing-instruction('bibliography')" mode="extract-aux">    <x:template match="processing-instruction('bibliography')" mode="extract-aux">
# Line 247  Line 214 
214    
215    <x:template match="h:span[@class='xref']">    <x:template match="h:span[@class='xref']">
216      <x:variable name="id" select="."/>      <x:variable name="id" select="."/>
217      <x:element name='a' namespace='http://www.w3.org/1999/xhtml'>      <a href='#{$id}'>
       <x:attribute name='href'>#<x:value-of select='$id'/></x:attribute>  
       <!--<x:text>Sect. </x:text>-->  
218        <x:apply-templates select="key('xrefs',$id)" mode="make-section-name"/>        <x:apply-templates select="key('xrefs',$id)" mode="make-section-name"/>
219      </x:element>      </a>
220    </x:template>    </x:template>
221    
222    <x:template match="h:span[@class='rcsinfo']">    <x:template match="h:span[@class='rcsinfo']">
# Line 259  Line 224 
224    </x:template>    </x:template>
225    
226    <x:template match="h:h1">    <x:template match="h:h1">
227      <x:element name='h1' namespace='http://www.w3.org/1999/xhtml'>      <h1 property='dc:title'>
       <x:attribute name='property'>dc:title</x:attribute>  
228        <x:apply-templates select="@*"/>        <x:apply-templates select="@*"/>
229        <x:apply-templates/>        <x:apply-templates/>
230      </x:element>      </h1>
231    </x:template>    </x:template>
232    
233    <x:template xmlns:owl="http://www.w3.org/2002/07/owl#" match="h:meta">    <x:template xmlns:owl="http://www.w3.org/2002/07/owl#" match="h:meta">
234      <x:choose>      <x:choose>
235        <x:when test="@name='DC.rights'">        <x:when test="@name='DC.rights'">
236          <x:element name='link' namespace='http://www.w3.org/1999/xhtml'>          <link about='' rel='{@name}' href='{@content}'/>
           <x:attribute name='about'/>  
           <x:attribute name="rel">  
             <x:value-of select="@name"/>  
           </x:attribute>  
           <x:attribute name="href">  
             <x:value-of select="@content"/>  
           </x:attribute>  
         </x:element>  
237        </x:when>        </x:when>
238        <x:when test="@name='rcsdate'">        <x:when test="@name='rcsdate'">
239          <x:element name='meta' namespace='http://www.w3.org/1999/xhtml'>          <meta about='' property='dcterms:modified'>
240            <x:attribute name='property'>dcterms:modified</x:attribute>            <x:attribute name='content'>
           <x:attribute name='about'/>  
           <x:attribute name="content">  
241              <x:value-of select="translate(substring(@content,8,10),'/','-')"/>              <x:value-of select="translate(substring(@content,8,10),'/','-')"/>
242              <x:text>T</x:text>              <x:text>T</x:text>
243              <x:value-of select="substring(@content,19,8)"/>              <x:value-of select="substring(@content,19,8)"/>
244            </x:attribute>            </x:attribute>
245          </x:element>          </meta>
246        </x:when>        </x:when>
247        <x:when test="@name='purl'">        <x:when test="@name='purl'">
248          <x:element name='link' namespace='http://www.w3.org/1999/xhtml'>          <link about='' rel='dc:identifier' href='{@content}'/>
249            <x:attribute name='rel'>dc:identifier</x:attribute>          <link about='' rel='owl:sameAs'    href='{@content}'/>
           <x:attribute name='about'/>  
           <x:attribute name="href">  
             <x:value-of select="@content"/>  
           </x:attribute>  
         </x:element>  
         <x:element name='link' namespace='http://www.w3.org/1999/xhtml'>  
           <x:attribute name='rel'>owl:sameAs</x:attribute>  
           <x:attribute name="href">  
             <x:value-of select="@content"/>  
           </x:attribute>  
         </x:element>  
250        </x:when>        </x:when>
251        <x:when test="starts-with(@name,'DC.')">        <x:when test="starts-with(@name,'DC.')">
252          <x:element name='meta' namespace='http://www.w3.org/1999/xhtml'>          <meta about='' content='{@content}'>
           <x:attribute name='about'/>  
253            <x:attribute name="property">dc:<x:value-of select="substring-after(@name, 'DC.')"/>            <x:attribute name="property">dc:<x:value-of select="substring-after(@name, 'DC.')"/>
254            </x:attribute>            </x:attribute>
255            <x:attribute name="content">          </meta>
             <x:value-of select="@content"/>  
           </x:attribute>  
         </x:element>  
256        </x:when>        </x:when>
257        <x:when test='@property and @content'>        <x:when test='@property and @content'>
258          <!-- it's a well-formed RDFa meta element, so copy it over -->          <!-- it's a well-formed RDFa meta element, so copy it over -->

Legend:
Removed from v.713  
changed lines
  Added in v.714

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26