xref: /aosp_15_r20/external/apache-xml/test/tests/contrib/xsltc/mk/mk051.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<xsl:stylesheet
2    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3    version="1.0"
4>
5
6  <!-- Test FileName: mk051.xsl -->
7  <!-- Source Attribution:
8       This test was written by Michael Kay and is taken from
9       'XSLT Programmer's Reference' published by Wrox Press Limited in 2000;
10       ISBN 1-861003-12-9; copyright Wrox Press Limited 2000; all rights reserved.
11       Now updated in the second edition (ISBN 1861005067), http://www.wrox.com.
12       No part of this book may be reproduced, stored in a retrieval system or
13       transmitted in any form or by any means - electronic, electrostatic, mechanical,
14       photocopying, recording or otherwise - without the prior written permission of
15       the publisher, except in the case of brief quotations embodied in critical articles or reviews.
16  -->
17  <!-- Example: scene.xml, scene.xsl -->
18  <!-- Chapter/Page: 8-544 -->
19  <!-- Purpose: Illustrate a rules-based stylesheet -->
20
21<xsl:variable name="backcolor" select="'#FFFFCC'" />
22
23<xsl:template match="SCENE|PROLOGUE|EPILOGUE">
24    <HTML>
25    <HEAD>
26        <TITLE><xsl:value-of select="TITLE"/></TITLE>
27    </HEAD>
28    <BODY BGCOLOR='{$backcolor}'>
29        <xsl:apply-templates/>
30    </BODY>
31    </HTML>
32</xsl:template>
33
34<xsl:template match="SPEECH">
35    <TABLE><TR>
36    <TD WIDTH="160" VALIGN="TOP">
37	<xsl:apply-templates select="SPEAKER"/>
38    </TD>
39    <TD VALIGN="TOP">
40    <xsl:apply-templates select="STAGEDIR|LINE"/>
41    </TD>
42	</TR></TABLE>
43</xsl:template>
44
45<xsl:template match="TITLE">
46    <H1><CENTER>
47	<xsl:apply-templates/>
48	</CENTER></H1><HR/>
49</xsl:template>
50
51<xsl:template match="SPEAKER">
52    <B>
53    <xsl:apply-templates/>
54    <xsl:if test="not(position()=last())"><BR/></xsl:if>
55    </B>
56</xsl:template>
57
58<xsl:template match="SCENE/STAGEDIR">
59    <CENTER><H3>
60	<xsl:apply-templates/>
61	</H3></CENTER>
62</xsl:template>
63
64<xsl:template match="SPEECH/STAGEDIR">
65    <P><I>
66	<xsl:apply-templates/>
67	</I></P>
68</xsl:template>
69
70<xsl:template match="LINE/STAGEDIR">
71     [ <I>
72	<xsl:apply-templates/>
73	</I> ]
74</xsl:template>
75
76<xsl:template match="SCENE/SUBHEAD">
77    <CENTER><H3>
78	<xsl:apply-templates/>
79	</H3></CENTER>
80</xsl:template>
81
82<xsl:template match="SPEECH/SUBHEAD">
83    <P><B>
84	<xsl:apply-templates/>
85	</B></P>
86</xsl:template>
87
88<xsl:template match="LINE">
89	<xsl:apply-templates/>
90	<BR/>
91</xsl:template>
92
93
94  <!--
95   * Licensed to the Apache Software Foundation (ASF) under one
96   * or more contributor license agreements. See the NOTICE file
97   * distributed with this work for additional information
98   * regarding copyright ownership. The ASF licenses this file
99   * to you under the Apache License, Version 2.0 (the  "License");
100   * you may not use this file except in compliance with the License.
101   * You may obtain a copy of the License at
102   *
103   *     http://www.apache.org/licenses/LICENSE-2.0
104   *
105   * Unless required by applicable law or agreed to in writing, software
106   * distributed under the License is distributed on an "AS IS" BASIS,
107   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
108   * See the License for the specific language governing permissions and
109   * limitations under the License.
110  -->
111
112</xsl:stylesheet>
113