xref: /aosp_15_r20/external/apache-xml/test/tests/contrib/xsltc/mk/mk015.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<xsl:stylesheet version="1.0"
2     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
4  <!-- Test FileName: mk015.xsl -->
5  <!-- Source Attribution:
6       This test was written by Michael Kay and is taken from
7       'XSLT Programmer's Reference' published by Wrox Press Limited in 2000;
8       ISBN 1-861003-12-9; copyright Wrox Press Limited 2000; all rights reserved.
9       Now updated in the second edition (ISBN 1861005067), http://www.wrox.com.
10       No part of this book may be reproduced, stored in a retrieval system or
11       transmitted in any form or by any means - electronic, electrostatic, mechanical,
12       photocopying, recording or otherwise - without the prior written permission of
13       the publisher, except in the case of brief quotations embodied in critical articles or reviews.
14  -->
15  <!-- Example: copy-of/soccer.xml, copy-of/soccer.xsl -->
16  <!-- Chapter/Page: 4-185 -->
17  <!-- Purpose: Using copy-of for repeated output -->
18
19<xsl:variable name="table-heading">
20    <tr>
21        <td><b>Date</b></td>
22        <td><b>Home Team</b></td>
23        <td><b>Away Team</b></td>
24        <td><b>Result</b></td>
25    </tr>
26</xsl:variable>
27
28<xsl:template match="/">
29<html><body>
30    <h1>Matches in Group <xsl:value-of select="/*/@group"/></h1>
31
32    <xsl:for-each select="//match">
33
34    <h2><xsl:value-of select="concat(team[1], ' versus ', team[2])"/></h2>
35
36    <table bgcolor="#cccccc" border="1" cellpadding="5">
37        <xsl:copy-of select="$table-heading"/>
38        <tr>
39        <td><xsl:value-of select="date"/>&#xa0;</td>
40        <td><xsl:value-of select="team[1]"/>&#xa0;</td>
41        <td><xsl:value-of select="team[2]"/>&#xa0;</td>
42        <td><xsl:value-of select="concat(team[1]/@score, '-', team[2]/@score)"/>&#xa0;</td>
43        </tr>
44    </table>
45    </xsl:for-each>
46</body></html>
47</xsl:template>
48
49
50  <!--
51   * Licensed to the Apache Software Foundation (ASF) under one
52   * or more contributor license agreements. See the NOTICE file
53   * distributed with this work for additional information
54   * regarding copyright ownership. The ASF licenses this file
55   * to you under the Apache License, Version 2.0 (the  "License");
56   * you may not use this file except in compliance with the License.
57   * You may obtain a copy of the License at
58   *
59   *     http://www.apache.org/licenses/LICENSE-2.0
60   *
61   * Unless required by applicable law or agreed to in writing, software
62   * distributed under the License is distributed on an "AS IS" BASIS,
63   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64   * See the License for the specific language governing permissions and
65   * limitations under the License.
66  -->
67
68</xsl:stylesheet>
69