xref: /aosp_15_r20/external/apache-xml/test/tests/contrib/enc/encSmoke.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3<xsl:output method="xml" indent="yes"/>
4
5<!-- XML Encoding tests -->
6<!-- The generic Identity transform -->
7
8  <xsl:template match="chartables">
9    <out>
10      <xsl:apply-templates select="chars"/>
11    </out>
12  </xsl:template>
13
14
15  <!-- Only bother with characters actually in this encoding -->
16  <xsl:template match="chars">
17    <chars-out>
18      <xsl:attribute name="enc"><xsl:value-of select="@enc"/></xsl:attribute>
19      <xsl:apply-templates select="char[c]"/>
20    </chars-out>
21  </xsl:template>
22
23  <xsl:template match="char">
24    <char-out>
25      <xsl:attribute name="dec"><xsl:value-of select="@dec"/></xsl:attribute>
26      <xsl:attribute name="desc"><xsl:value-of select="@desc"/></xsl:attribute>
27      <xsl:apply-templates select="c | e"/>
28    </char-out>
29  </xsl:template>
30
31  <xsl:template match="c">
32    <c-out><xsl:call-template name="output-chars"/></c-out>
33  </xsl:template>
34
35  <xsl:template match="e">
36    <e-out><xsl:call-template name="output-chars"/></e-out>
37  </xsl:template>
38
39  <!-- Avoid extra whitespace to limit test -->
40  <xsl:template name="output-chars">
41    <cpo><xsl:copy-of select="."/></cpo>
42    <vo><xsl:value-of select="."/></vo>
43    <vod><xsl:value-of disable-output-escaping="yes" select="."/></vod>
44    <xsl:variable name="var" select="."/>
45    <var><xsl:value-of select="$var"/></var>
46    <vard><xsl:value-of disable-output-escaping="yes" select="$var"/></vard>
47  </xsl:template>
48
49<!-- Override plain text() processing -->
50<xsl:template match="text()"></xsl:template>
51
52
53  <!--
54   * Licensed to the Apache Software Foundation (ASF) under one
55   * or more contributor license agreements. See the NOTICE file
56   * distributed with this work for additional information
57   * regarding copyright ownership. The ASF licenses this file
58   * to you under the Apache License, Version 2.0 (the  "License");
59   * you may not use this file except in compliance with the License.
60   * You may obtain a copy of the License at
61   *
62   *     http://www.apache.org/licenses/LICENSE-2.0
63   *
64   * Unless required by applicable law or agreed to in writing, software
65   * distributed under the License is distributed on an "AS IS" BASIS,
66   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
67   * See the License for the specific language governing permissions and
68   * limitations under the License.
69  -->
70
71</xsl:stylesheet>
72