xref: /aosp_15_r20/external/apache-xml/test/tests/conf/reluri/reluri11.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: reluri11 -->
5  <!-- Document: http://www.w3.org/TR/xslt -->
6  <!-- DocVersion: 19991116 -->
7  <!-- Section: 12.1 Multiple Source Documents -->
8  <!-- Creator: Myriam Midy -->
9  <!-- Purpose: Testing how a relative URI specified in document() is resolved by default. -->
10  <!-- Elaboration: "If the second argument [to document()] is omitted,
11     then it [the base URI for resolving the relative URI] defaults to
12     the node in the stylesheet that contains the expression
13     that includes the call to the document function." The inner call to document, using
14     a filename argument rather than a node-set, opens the designated file and gets a node-set
15     whose base is that file (or the directory containing it). Further pathing within the
16     node-set results in a filename element that contains "level3/xreluri09a.xml" as text.
17     The outer call to document() is getting a node-set with a base URI that is not the same as
18     this stylesheet nor the reluri11.xml supplied as an argument. Thus, the relative path
19     beginning with level3/... (from the inner document call) can only be resolved if
20     the outer document() call obtained the base URI of the node-set it was passed as
21     its (one) argument. The node-set derived from the file named by the filename has the
22     necessary 'body' element. -->
23
24<xsl:output method="xml" indent="yes"/>
25
26<xsl:template match="doc">
27  <out>
28    <xsl:copy-of select="document(document('level1/level2/xreluri11b.xml')/*/filename)/*/body"/>
29  </out>
30</xsl:template>
31
32
33  <!--
34   * Licensed to the Apache Software Foundation (ASF) under one
35   * or more contributor license agreements. See the NOTICE file
36   * distributed with this work for additional information
37   * regarding copyright ownership. The ASF licenses this file
38   * to you under the Apache License, Version 2.0 (the  "License");
39   * you may not use this file except in compliance with the License.
40   * You may obtain a copy of the License at
41   *
42   *     http://www.apache.org/licenses/LICENSE-2.0
43   *
44   * Unless required by applicable law or agreed to in writing, software
45   * distributed under the License is distributed on an "AS IS" BASIS,
46   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47   * See the License for the specific language governing permissions and
48   * limitations under the License.
49  -->
50
51</xsl:stylesheet>
52