xref: /aosp_15_r20/external/apache-xml/test/tests/contrib/xsltc/mk/mk062.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<xsl:stylesheet version='1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2
3
4
5  <!-- Test FileName: mk062.xsl -->
6
7  <!-- Source Document: XSLT Programmer's Reference by Michael Kay -->
8
9  <!-- Example: othello.xml, play.dtd, play.xsl -->
10
11  <!-- Chapter/Page:  -->
12
13  <!-- Purpose: Format a Shakespearean play  -->
14
15
16
17<xsl:output method="text"/>
18
19
20
21<!-- This stylesheet outputs the book list as a CSV file -->
22
23
24
25<xsl:template match="BOOKLIST">
26
27        <xsl:apply-templates select="BOOKS"/>
28
29</xsl:template>
30
31
32
33<xsl:template match="BOOKS">
34
35Title,Author,Category<xsl:text/>
36
37<xsl:for-each select="ITEM">
38
39"<xsl:value-of select="TITLE"/>","<xsl:value-of select="AUTHOR"/>","<xsl:value-of select="@CAT"/>(<xsl:text/>
40
41        <xsl:choose>
42
43        <xsl:when test='@CAT="F"'>Fiction</xsl:when>
44
45        <xsl:when test='@CAT="S"'>Science</xsl:when>
46
47        <xsl:when test='@CAT="C"'>Computing</xsl:when>
48
49        <xsl:when test='@CAT="X"'>Crime</xsl:when>
50
51        <xsl:otherwise>Unclassified</xsl:otherwise>
52
53        </xsl:choose>)"<xsl:text/>
54
55</xsl:for-each><xsl:text>
56
57</xsl:text>
58
59</xsl:template>
60
61  <!--
62   * Licensed to the Apache Software Foundation (ASF) under one
63   * or more contributor license agreements. See the NOTICE file
64   * distributed with this work for additional information
65   * regarding copyright ownership. The ASF licenses this file
66   * to you under the Apache License, Version 2.0 (the  "License");
67   * you may not use this file except in compliance with the License.
68   * You may obtain a copy of the License at
69   *
70   *     http://www.apache.org/licenses/LICENSE-2.0
71   *
72   * Unless required by applicable law or agreed to in writing, software
73   * distributed under the License is distributed on an "AS IS" BASIS,
74   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
75   * See the License for the specific language governing permissions and
76   * limitations under the License.
77  -->
78
79</xsl:stylesheet>
80