Mercurial > hg > mpdl-group
comparison software/mpdl-services/mpiwg-mpdl-cms/build/classes/de/mpg/mpiwg/berlin/mpdl/cms/transform/pageEchoSpan.xsl @ 23:e845310098ba
diverse Korrekturen
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 27 Nov 2012 12:35:19 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
22:6a45a982c333 | 23:e845310098ba |
---|---|
1 <?xml version="1.0"?> | |
2 <xsl:stylesheet version="2.0" | |
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
4 xmlns:xlink="http://www.w3.org/1999/xlink" | |
5 xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
6 xmlns:functx="http://www.functx.com" | |
7 xmlns:saxon="http://saxon.sf.net/" | |
8 xmlns:dc="http://purl.org/dc/elements/1.1/" | |
9 xmlns:dcterms="http://purl.org/dc/terms" | |
10 xmlns:echo="http://www.mpiwg-berlin.mpg.de/ns/echo/1.0/" | |
11 xmlns:math="http://www.w3.org/1998/Math/MathML" | |
12 xmlns:mml="http://www.w3.org/1998/Math/MathML" | |
13 xmlns:svg="http://www.w3.org/2000/svg" | |
14 xmlns:xhtml="http://www.w3.org/1999/xhtml" | |
15 exclude-result-prefixes="xsl xlink xs functx saxon dc dcterms echo math mml svg xhtml" | |
16 > | |
17 | |
18 <xsl:output method="xhtml" encoding="utf-8"/> | |
19 | |
20 <xsl:param name="mode"></xsl:param> | |
21 <xsl:param name="normalization"></xsl:param> | |
22 | |
23 <xsl:variable name="dictionaryServiceName" select="'http://mpdl-service.mpiwg-berlin.mpg.de/mpiwg-mpdl-lt-web/lt/GetDictionaryEntries'"/> | |
24 | |
25 <xsl:template match="*:echo"> | |
26 <span class="page"> | |
27 <xsl:apply-templates mode="text"/> | |
28 </span> | |
29 </xsl:template> | |
30 | |
31 <xsl:template match="*:head|*:div|*:p|*:s|*:pb|*:cb|*:expan|*:emph|*:quote|*:q|*:blockquote|*:set-off|*:reg|*:var|*:num|*:gap|*:anchor|*:note|*:figure|*:caption|*:description|*:handwritten|*:place|*:person" mode="text"> | |
32 <xsl:element name="span"> | |
33 <xsl:attribute name="class"><xsl:value-of select="name()"/></xsl:attribute> | |
34 <xsl:copy-of select="@*"/> | |
35 <xsl:apply-templates mode="text"/> | |
36 </xsl:element> | |
37 </xsl:template> | |
38 | |
39 <!-- MathML --> | |
40 <xsl:template match="math:*" mode="text"> | |
41 <xsl:element name="{name()}" namespace=""> | |
42 <xsl:copy-of select="@*"/> | |
43 <xsl:apply-templates mode="text"/> | |
44 </xsl:element> | |
45 </xsl:template> | |
46 | |
47 <!-- SVG --> | |
48 <xsl:template match="svg:*" mode="text"> | |
49 <xsl:element name="{name()}" namespace=""> | |
50 <xsl:copy-of select="@*"/> | |
51 <xsl:apply-templates mode="text"/> | |
52 </xsl:element> | |
53 </xsl:template> | |
54 | |
55 <xsl:template match="*:lb" mode="text"> | |
56 <br/><xsl:apply-templates mode="text"/> | |
57 </xsl:template> | |
58 | |
59 <!-- XHTML: remove the xhtml namespace --> | |
60 <xsl:template match="xhtml:*" mode="text"> | |
61 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/> | |
62 <xsl:variable name="isTable" select="name() = 'table'"/> | |
63 <xsl:choose> | |
64 <xsl:when test="(not($hasLabel)) or ($isTable and $hasLabel)"> | |
65 <xsl:element name="{name()}" namespace=""> | |
66 <xsl:copy-of select="@*"/> | |
67 <xsl:apply-templates mode="text"/> | |
68 </xsl:element> | |
69 </xsl:when> | |
70 <xsl:otherwise></xsl:otherwise> | |
71 </xsl:choose> | |
72 </xsl:template> | |
73 | |
74 | |
75 <!-- words --> | |
76 <xsl:template match="*:w" mode="text"> | |
77 <xsl:variable name="wordLanguage" select="@lang"/> | |
78 <xsl:variable name="form" select="encode-for-uri(string(@form))"/> | |
79 <xsl:variable name="formNotUrlEncoded" select="string(@form)"/> | |
80 <xsl:variable name="formRegularized" select="string(@formRegularized)"/> | |
81 <xsl:variable name="formNormalized" select="string(@formNormalized)"/> | |
82 <xsl:variable name="lemmas" select="string(@lemmas)"/> | |
83 <xsl:variable name="dictionary" select="string(@dictionary)"/> | |
84 <xsl:variable name="displayWord"> | |
85 <xsl:choose> | |
86 <xsl:when test="$normalization = 'orig'"><xsl:apply-templates mode="text"/></xsl:when> | |
87 <xsl:when test="$normalization = 'reg' and $formRegularized = ''"><xsl:apply-templates mode="text"/></xsl:when> | |
88 <xsl:when test="$normalization = 'reg' and $formRegularized != ''"><xsl:sequence select="$formRegularized"/></xsl:when> | |
89 <xsl:when test="$normalization = 'norm'"><xsl:apply-templates mode="text"/></xsl:when> | |
90 <xsl:otherwise><xsl:apply-templates mode="text"/></xsl:otherwise> | |
91 </xsl:choose> | |
92 </xsl:variable> | |
93 <xsl:variable name="displayWordUrlEncoded" select="encode-for-uri($displayWord)"/> | |
94 <xsl:choose> | |
95 <xsl:when test="$dictionary = 'true' and $mode = 'tokenized'"> | |
96 <span class="w"> | |
97 <xsl:copy-of select="@*"/> | |
98 <xsl:attribute name="href"><xsl:value-of select="concat($dictionaryServiceName, '?query=', $form, '&queryDisplay=', $displayWordUrlEncoded, '&language=', $wordLanguage, '&outputFormat=html', '&outputType=morphCompact&outputType=dictFull')"/></xsl:attribute> | |
99 <xsl:sequence select="$displayWord"/> | |
100 </span> | |
101 </xsl:when> | |
102 <xsl:otherwise> | |
103 <xsl:sequence select="$displayWord"/> | |
104 </xsl:otherwise> | |
105 </xsl:choose> | |
106 </xsl:template> | |
107 | |
108 <xsl:template match="text()" mode="text"> | |
109 <xsl:value-of select="."/> | |
110 </xsl:template> | |
111 | |
112 </xsl:stylesheet> |