Changes between Initial Version and Version 1 of xlstBeispiel


Ignore:
Timestamp:
Jan 11, 2007, 8:40:53 PM (17 years ago)
Author:
dwinter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • xlstBeispiel

    v1 v1  
     1Beispiel für ein xsl File, dass die nach morphologischer Analyse getaggten Files mit Links zum Dictionary versieht.
     2
     3{{{
     4
     5<?xml version="1.0" encoding="ISO-8859-1"?>
     6
     7<xsl:stylesheet version="1.0"
     8xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     9xmlns:mpiwg="http://www.mpiwg-berlin.mpg.de/namespace">
     10<xsl:output method="html"/>
     11
     12<xsl:template match="/">
     13
     14<html>
     15  <head>
     16      <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
     17      <link rel="stylesheet" type="text/css" href="http://archimedes.mpiwg-berlin.mpg.de/arch/css/archtexts.css"/>
     18  </head>
     19
     20 <body>
     21    <xsl:apply-templates/>
     22   
     23  </body>
     24</html>
     25</xsl:template>
     26
     27<xsl:template match="//s">
     28
     29<mpiwg:s class="{@class}">
     30<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
     31             <xsl:apply-templates/>
     32</mpiwg:s>
     33</xsl:template>
     34
     35<xsl:template match="//lb">
     36
     37             <xsl:apply-templates/>
     38<br/>
     39</xsl:template>
     40
     41<xsl:template match="//div">
     42<div class="{@class}">
     43
     44             <xsl:apply-templates/>
     45</div>
     46
     47</xsl:template>
     48<xsl:template match="//img">
     49<img src="{@src}" alt="{@alt}">
     50
     51             <xsl:apply-templates/>
     52</img>
     53
     54</xsl:template>
     55
     56
     57<xsl:template match="//table">
     58<table width="{@width}" class="{@class}">
     59             <xsl:apply-templates/>
     60</table>
     61</xsl:template>
     62
     63<xsl:template match="//tr">
     64<tr>
     65             <xsl:apply-templates/>
     66</tr>
     67</xsl:template>
     68<xsl:template match="//td">
     69<td>
     70
     71             <xsl:apply-templates/>
     72</td>
     73</xsl:template>
     74
     75<xsl:template match="//span">
     76<span class="{@class}">
     77
     78             <xsl:apply-templates/>
     79</span>
     80</xsl:template>
     81
     82<xsl:template match="//sub">
     83<sub>
     84
     85             <xsl:apply-templates/>
     86</sub>
     87</xsl:template>
     88
     89<xsl:template match="//sup">
     90<sup>
     91
     92             <xsl:apply-templates/>
     93</sup>
     94</xsl:template>
     95
     96
     97<!-- todo: probably better to convert center to span and handle in css-->
     98
     99
     100<xsl:template match="//center">
     101<center>
     102
     103             <xsl:apply-templates/>
     104</center>
     105</xsl:template>
     106<xsl:template match="//small">
     107<small>
     108
     109             <xsl:apply-templates/>
     110</small>
     111</xsl:template>
     112<xsl:template match="//br">
     113<br>
     114
     115             <xsl:apply-templates/>
     116</br>
     117</xsl:template>
     118
     119
     120<xsl:template match="//p">
     121
     122<p class="{@class}">
     123
     124             <xsl:apply-templates/>
     125</p>
     126</xsl:template>
     127<xsl:template match="//pb">
     128
     129<span class="pagenum">
     130              <xsl:value-of select="@pagenum"/>
     131             <xsl:apply-templates/>
     132</span>
     133<br/>
     134</xsl:template>
     135
     136
     137<xsl:template match="//mpiwg:w">
     138
     139<!--
     140http://perseus.mpiwg-berlin.mpg.de/cgi-bin/morphindex?lang=latin;lookup=
     141-->
     142<xsl:variable name="thislang"><xsl:value-of select="@lang"/></xsl:variable>
     143<!--<xsl:variable name="analysed"><xsl:value-of select="@mpiwg:analysed"/></xsl:variable>  ## auskommentieren dann werden nur analysierte verlinkt-->
     144<xsl:variable name="analysed">yes</xsl:variable><!-- alle verlinken, analysiert wird immer auf yes gesetzt -->
     145<xsl:text> </xsl:text>
     146<xsl:choose>
     147<xsl:when test='$analysed="yes"'>
     148<xsl:choose>
     149
     150        <xsl:when test='$thislang="nl"'>
     151<a>
     152     <xsl:attribute name="href">http://141.14.236.86/cgi-bin/toc/dict?step=remotetable;word=<xsl:value-of select="@mpiwg:form"/>;lang=<xsl:value-of select="@lang"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute><xsl:apply-templates/>
     153
     154</a>
     155</xsl:when>
     156               
     157<xsl:when test='$thislang="fr"'>
     158<a>
     159
     160     <xsl:attribute name="href">http://141.14.236.86/cgi-bin/toc/dict?step=remotetable;word=<xsl:value-of select="@mpiwg:form"/>;lang=<xsl:value-of select="@lang"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute><xsl:apply-templates/>
     161
     162</a>
     163</xsl:when>
     164
     165<xsl:when test='$thislang="de"'>
     166<a>
     167
     168     <xsl:attribute name="href">http://141.14.236.86/cgi-bin/toc/dict?step=remotetable;word=<xsl:value-of select="@mpiwg:form"/>;lang=<xsl:value-of select="@lang"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute><xsl:apply-templates/>
     169
     170</a>
     171</xsl:when>
     172
     173<xsl:otherwise>
     174<a>
     175     <xsl:attribute name="href">http://141.14.236.86/cgi-bin/toc/dict?step=table;word=<xsl:value-of select="@mpiwg:form"/>;lang=<xsl:value-of select="@lang"/>;pro=<xsl:value-of select="@pro"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute><xsl:apply-templates/>
     176</a>
     177</xsl:otherwise>
     178</xsl:choose>
     179</xsl:when>
     180<xsl:otherwise>
     181<a>
     182<xsl:apply-templates/>
     183</a>
     184</xsl:otherwise>
     185</xsl:choose>
     186</xsl:template>
     187
     188<!-- form -->
     189
     190<xsl:template match="//foreign[@lang='greek']">
     191<G>
     192             <xsl:apply-templates/>
     193        </G>
     194           
     195</xsl:template>
     196<xsl:template match="//foreign[@lang='el']">
     197<G>
     198             <xsl:apply-templates/>
     199        </G>
     200           
     201</xsl:template>
     202
     203
     204
     205<!-- non-implemented tags after here -->
     206
     207<!-- author -->
     208
     209<xsl:template match="//author">
     210          <font class="author">
     211             <xsl:apply-templates/>
     212        </font>
     213           
     214      </xsl:template>
     215
     216<!-- ETYM -->
     217<xsl:template match="//etym">
     218          <font class="etym">
     219             <xsl:apply-templates/>
     220        </font>
     221           
     222      </xsl:template>
     223
     224<!-- USG -->
     225
     226
     227</xsl:stylesheet>
     228
     229}}}