xref: /aosp_15_r20/external/apache-xml/test/tests/conf/namespace/namespace141.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
4  <!-- FileName: namespace141 -->
5  <!-- Document: http://www.w3.org/TR/xslt -->
6  <!-- DocVersion: 19991116 -->
7  <!-- Section: 7.1.2 Creating Elements -->
8  <!-- Creator: Gordon Chiu -->
9  <!-- Purpose: Test for resetting of an unspecified default namespace by copy-of. -->
10  <!-- extended variant of namespace137 to check special cases -->
11
12<xsl:output method="xml" indent="no" encoding="UTF-8"/>
13
14<xsl:template match = "/">
15  <!-- create an RTF with a mix of namespaced and non-namespaced elements -->
16  <xsl:variable name="x">
17    <xsl:element name="hello1"/>
18    <xsl:element name="hello2" namespace="http://literalURI">
19      <xsl:element name="hiya" namespace=""/>
20    </xsl:element>
21    <xsl:text>&#10;</xsl:text>
22    <xsl:element name="hello3" namespace="http://literalURI2">
23      <xsl:element name="yo1" namespace="http://literalURI"/>
24      <xsl:element name="yo2" namespace=""/>
25    </xsl:element>
26    <xsl:text>&#10;</xsl:text>
27    <xsl:element name="hello4">
28      <xsl:element name="hey" namespace=""/>
29    </xsl:element>
30  </xsl:variable>
31  <!-- Now start an output tree, with a namespace node, and copy in the RTF -->
32  <out>
33    <xsl:text>&#10;</xsl:text>
34    <xsl:element name="literalName" namespace="http://literalURI">
35      <xsl:text>&#10;</xsl:text>
36      <xsl:copy-of select="$x"/>
37    </xsl:element>
38  </out>
39</xsl:template>
40
41
42  <!--
43   * Licensed to the Apache Software Foundation (ASF) under one
44   * or more contributor license agreements. See the NOTICE file
45   * distributed with this work for additional information
46   * regarding copyright ownership. The ASF licenses this file
47   * to you under the Apache License, Version 2.0 (the  "License");
48   * you may not use this file except in compliance with the License.
49   * You may obtain a copy of the License at
50   *
51   *     http://www.apache.org/licenses/LICENSE-2.0
52   *
53   * Unless required by applicable law or agreed to in writing, software
54   * distributed under the License is distributed on an "AS IS" BASIS,
55   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
56   * See the License for the specific language governing permissions and
57   * limitations under the License.
58  -->
59
60</xsl:stylesheet>
61