Project

Profile

Help

How to connect?
Download (5.01 KB) Statistics
| Branch: | Tag: | Revision:

he / tags / 9.9.1.4 / samples / styles / play.xsl @ c74fd4aa

1
<xsl:stylesheet 
2
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
4
    exclude-result-prefixes="xs"
5
    version="2.0">
6

    
7
<!-- parameter "dir" must be set from the command line: it represents the output directory -->
8

    
9
<xsl:variable name="backcolor" select="'#FFFFCC'" />
10
<xsl:variable name="panelcolor" select="'#88FF88'" />
11

    
12
<xsl:param name="dir" required="yes" as="xs:string"/>
13

    
14
<xsl:output name="play" method="html"/>
15
<xsl:output name="scene" method="html"/>
16

    
17
<xsl:template match="PLAY">
18
    <xsl:if test="not($dir)">
19
        <xsl:message terminate="yes">Parameter "dir" has not been set</xsl:message>
20
    </xsl:if>
21
    <xsl:result-document href="{$dir}/play.html" format="play">
22
    <html>
23
      <head>
24
        <title><xsl:apply-templates select="TITLE"/></title>
25
      </head>
26
      <body bgcolor='{$backcolor}'>
27
        <center>
28
            <h1><xsl:value-of select="TITLE"/></h1>
29
            <h3><xsl:apply-templates select="PLAYSUBT"/></h3>
30
            <i><xsl:apply-templates select="SCNDESCR"/></i>
31
        </center>
32
        <br/><br/>
33
        <table>
34
          <tr>
35
            <td width='350' valign='top' bgcolor='{$panelcolor}'>
36
              <xsl:apply-templates select="PERSONAE"/>
37
            </td>
38
            <td width='30'></td>
39
            <td valign='top'>
40
              <xsl:apply-templates select="PROLOGUE | ACT | EPILOGUE"/>
41
            </td>
42
          </tr>
43
        </table>
44
        <hr/>
45
      </body>
46
    </html>
47
    </xsl:result-document>
48
</xsl:template>
49

    
50
<xsl:template match="ACT/TITLE">
51
    <center>
52
      <h3>
53
	    <xsl:apply-templates/>
54
      </h3>
55
    </center>
56
</xsl:template>
57

    
58
<xsl:template match="PLAYSUBT">
59
	<xsl:apply-templates/>
60
</xsl:template>
61

    
62
<xsl:template match="PERSONAE">
63
	<xsl:apply-templates/>
64
</xsl:template>
65

    
66
<xsl:template match="PERSONAE/TITLE">
67
    <center>
68
      <h3>
69
	    <xsl:apply-templates/>
70
      </h3>
71
    </center>
72
</xsl:template>
73

    
74
<xsl:template match="PERSONAE/PERSONA">
75
    <table>
76
      <tr>
77
        <td valign="top">
78
	      <xsl:apply-templates/>
79
        </td>
80
      </tr>
81
    </table>
82
</xsl:template>
83

    
84
<xsl:template match="PGROUP">
85
    <table>
86
      <tr>
87
        <td width="160" valign="top">
88
	      <xsl:apply-templates select="PERSONA"/>
89
	    </td>
90
	    <td width="20"></td>
91
	    <td valign="bottom">
92
	      <i>
93
	        <xsl:apply-templates select="GRPDESCR"/>
94
	      </i>
95
	    </td>
96
	  </tr>
97
	</table>
98
</xsl:template>
99

    
100
<xsl:template match="PGROUP/PERSONA">
101
    <xsl:apply-templates/>
102
    <br/>
103
</xsl:template>
104

    
105
<xsl:template match="PGROUP/GRPDESCR">
106
    <xsl:apply-templates/>
107
    <br/>
108
</xsl:template>
109

    
110
<xsl:template match="SCNDESCR">
111
	<xsl:apply-templates/>
112
</xsl:template>
113

    
114
<xsl:template match="ACT">
115
    <hr/>
116
	<xsl:apply-templates/>
117
    <xsl:if test="position()=last()"><hr/></xsl:if>
118
</xsl:template>
119

    
120
<xsl:template match="SCENE|PROLOGUE|EPILOGUE">
121
    <xsl:variable name="NR"><xsl:number count="SCENE|PROLOGUE|EPILOGUE" level="any"/></xsl:variable>
122
    <xsl:variable name="play"><xsl:value-of select="ancestor::PLAY/TITLE"/></xsl:variable>
123
    <xsl:variable name="act"><xsl:value-of select="ancestor::ACT/TITLE"/></xsl:variable>
124

    
125
    <a href="scene{$NR}.html">
126
        <xsl:value-of select="TITLE" />
127
    </a>
128
    <br/>
129

    
130
    <xsl:result-document href="{$dir}/scene{$NR}.html" format="scene">
131
      <html>
132
        <head>
133
          <title>
134
            <xsl:value-of select="concat($play, ' ', $act, ': ', TITLE)"/>
135
          </title>
136
        </head>
137
        <body bgcolor='{$backcolor}'>
138
          <p>
139
            <a href="play.html"><xsl:value-of select="$play"/></a>
140
            <br/>
141
            <b><xsl:value-of select="$act"/></b>
142
            <br/>
143
          </p>
144
          <xsl:apply-templates/>
145
        </body>
146
      </html>
147
    </xsl:result-document>
148
</xsl:template>
149

    
150
<xsl:template match="SCENE/TITLE | PROLOGUE/TITLE | EPILOGUE/TITLE">
151
    <h1>
152
      <center>
153
	    <xsl:apply-templates/>
154
	  </center>
155
	</h1>
156
	<hr/>
157
</xsl:template>
158

    
159
<xsl:template match="SPEECH">
160
    <table>
161
      <tr>
162
        <td width="160" valign="top">
163
	      <xsl:apply-templates select="SPEAKER"/>
164
        </td>
165
        <td table="top">
166
          <xsl:apply-templates select="STAGEDIR|LINE"/>
167
        </td>
168
	  </tr>
169
	</table>
170
</xsl:template>
171

    
172
<xsl:template match="SPEAKER">
173
    <b>
174
      <xsl:apply-templates/>
175
      <xsl:if test="not(position()=last())"><br/></xsl:if>
176
    </b>
177
</xsl:template>
178

    
179
<xsl:template match="SCENE/STAGEDIR">
180
    <center>
181
      <h3>
182
	    <xsl:apply-templates/>
183
	  </h3>
184
	</center>
185
</xsl:template>
186

    
187
<xsl:template match="SPEECH/STAGEDIR">
188
    <p>
189
      <i>
190
	    <xsl:apply-templates/>
191
	  </i>
192
	</p>
193
</xsl:template>
194

    
195
<xsl:template match="LINE/STAGEDIR">
196
    <xsl:text> [ </xsl:text>
197
    <i>
198
	  <xsl:apply-templates/>
199
	</i>
200
	<xsl:text> ] </xsl:text>
201
</xsl:template>
202

    
203
<xsl:template match="SCENE/SUBHEAD">
204
    <center>
205
      <h3>
206
	    <xsl:apply-templates/>
207
	  </h3>
208
	</center>
209
</xsl:template>
210

    
211
<xsl:template match="SPEECH/SUBHEAD">
212
    <p>
213
      <b>
214
	    <xsl:apply-templates/>
215
	  </b>
216
	</p>
217
</xsl:template>
218

    
219
<xsl:template match="LINE">
220
	<xsl:apply-templates/>
221
	<br/>
222
</xsl:template>
223

    
224
</xsl:stylesheet>	
(8-8/12)