xref: /aosp_15_r20/external/apache-xml/test/tests/contrib/xsltc/mk/mk025.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<xsl:stylesheet version="1.0"
2     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
4  <!-- Test FileName: mk025.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: poem.xml, poem.xsl -->
16  <!-- Chapter/Page: 4-247 -->
17  <!-- Purpose: Numbering the lines of a poem -->
18
19<xsl:template match="/">
20<html><body>
21<p><xsl:apply-templates select="/poem/stanza"/></p>
22</body></html>
23</xsl:template>
24
25<xsl:template match="stanza">
26<p><table><xsl:apply-templates/></table></p>
27</xsl:template>
28
29<xsl:template match="line">
30<tr>
31<td width="350"><xsl:value-of select="."/></td>
32<td width="50">
33   <xsl:variable name="line-nr">
34      <xsl:number level="any" from="poem"/>
35   </xsl:variable>
36   <xsl:if test="$line-nr mod 3 = 0">
37      <xsl:value-of select="$line-nr"/>
38   </xsl:if>
39</td>
40</tr>
41</xsl:template>
42
43  <!--
44   * Licensed to the Apache Software Foundation (ASF) under one
45   * or more contributor license agreements. See the NOTICE file
46   * distributed with this work for additional information
47   * regarding copyright ownership. The ASF licenses this file
48   * to you under the Apache License, Version 2.0 (the  "License");
49   * you may not use this file except in compliance with the License.
50   * You may obtain a copy of the License at
51   *
52   *     http://www.apache.org/licenses/LICENSE-2.0
53   *
54   * Unless required by applicable law or agreed to in writing, software
55   * distributed under the License is distributed on an "AS IS" BASIS,
56   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
57   * See the License for the specific language governing permissions and
58   * limitations under the License.
59  -->
60
61</xsl:stylesheet>
62