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