xref: /aosp_15_r20/external/apache-xml/test/tests/contrib/xsltc/mk/mk041.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<?xml version="1.0" encoding="iso-8859-1"?>
2<xsl:transform
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 version="1.0"
5>
6
7  <!-- Test FileName: mk041.xsl -->
8  <!-- Source Attribution:
9       This test was written by Michael Kay and is taken from
10       'XSLT Programmer's Reference' published by Wrox Press Limited in 2000;
11       ISBN 1-861003-12-9; copyright Wrox Press Limited 2000; all rights reserved.
12       Now updated in the second edition (ISBN 1861005067), http://www.wrox.com.
13       No part of this book may be reproduced, stored in a retrieval system or
14       transmitted in any form or by any means - electronic, electrostatic, mechanical,
15       photocopying, recording or otherwise - without the prior written permission of
16       the publisher, except in the case of brief quotations embodied in critical articles or reviews.
17  -->
18  <!-- Example: issue-dates.xml, format-dates.xsl -->
19  <!-- Chapter/Page: 7-476 -->
20  <!-- Purpose: Using lang function for localizing dates -->
21
22<xsl:output encoding="iso-8859-1"/>
23
24<data xmlns="data.uri">
25<months xml:lang="en">
26   <m>January</m><m>February</m><m>March</m><m>April</m>
27   <m>May</m><m>June</m><m>July</m><m>August</m>
28   <m>September</m><m>October</m><m>November</m><m>December</m>
29</months>
30<months xml:lang="fr">
31   <m>Janvier</m><m>F�vrier</m><m>Mars</m><m>Avril</m>
32   <m>Mai</m><m>Juin</m><m>Juillet</m><m>Ao�t</m>
33   <m>Septembre</m><m>Octobre</m><m>Novembre</m><m>D�cembre</m>
34</months>
35<months xml:lang="de">
36   <m>Januar</m><m>Februar</m><m>M�rz</m><m>April</m>
37   <m>Mai</m><m>Juni</m><m>Juli</m><m>August</m>
38   <m>September</m><m>Oktober</m><m>November</m><m>Dezember</m>
39</months>
40</data>
41
42<xsl:param name="language" select="'en'"/>
43
44<xsl:template match="iso-date">
45<date xmlns:data="data.uri" xsl:exclude-result-prefixes="data">
46   <xsl:value-of select="substring(., 7, 2)"/>
47   <xsl:text> </xsl:text>
48   <xsl:variable name="month" select="number(substring(.,5,2))"/>
49   <xsl:value-of select="document('')/*/data:data/data:months[lang($language)]/data:m[$month]"/>
50   <xsl:text> </xsl:text>
51   <xsl:value-of select="substring(., 1, 4)"/>
52</date>
53</xsl:template>
54
55  <!--
56   * Licensed to the Apache Software Foundation (ASF) under one
57   * or more contributor license agreements. See the NOTICE file
58   * distributed with this work for additional information
59   * regarding copyright ownership. The ASF licenses this file
60   * to you under the Apache License, Version 2.0 (the  "License");
61   * you may not use this file except in compliance with the License.
62   * You may obtain a copy of the License at
63   *
64   *     http://www.apache.org/licenses/LICENSE-2.0
65   *
66   * Unless required by applicable law or agreed to in writing, software
67   * distributed under the License is distributed on an "AS IS" BASIS,
68   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
69   * See the License for the specific language governing permissions and
70   * limitations under the License.
71  -->
72
73</xsl:transform>
74