xref: /aosp_15_r20/external/apache-xml/test/tests/extensions/java/javaRedir1.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2    version="1.0"
3    xmlns:lxslt="http://xml.apache.org/xslt"
4    xmlns:redirect="org.apache.xalan.lib.Redirect"
5    extension-element-prefixes="redirect"
6    exclude-result-prefixes="lxslt">
7
8<!-- Copied from xml-xalan/java/samples/extensions/1-redir.xsl -->
9
10  <lxslt:component prefix="redirect" elements="write open close" functions="">
11    <lxslt:script lang="javaclass" src="org.apache.xalan.lib.Redirect"/>
12  </lxslt:component>
13
14  <xsl:template match="/">
15    <standard-out>
16      Standard output:
17      <xsl:apply-templates/>
18    </standard-out>
19  </xsl:template>
20
21  <!-- not redirected -->
22  <xsl:template match="doc/main">
23    <main>
24    -- look in <xsl:value-of select="/doc/foo/@file"/> for the redirected output --
25      <xsl:apply-templates/>
26    </main>
27  </xsl:template>
28
29  <!-- redirected -->
30  <xsl:template match="doc/foo">
31    <!-- get redirect file name from XML input -->
32    <redirect:write select="@file">
33      <foo-out>
34        <xsl:apply-templates/>
35      </foo-out>
36    </redirect:write>
37  </xsl:template>
38
39<!-- redirected (from the xsl:apply-templates above. I.e., bar is in /doc/foo -->
40  <xsl:template match="bar">
41    <foobar-out>
42      <xsl:apply-templates/>
43    </foobar-out>
44  </xsl:template>
45
46
47  <!--
48   * Licensed to the Apache Software Foundation (ASF) under one
49   * or more contributor license agreements. See the NOTICE file
50   * distributed with this work for additional information
51   * regarding copyright ownership. The ASF licenses this file
52   * to you under the Apache License, Version 2.0 (the  "License");
53   * you may not use this file except in compliance with the License.
54   * You may obtain a copy of the License at
55   *
56   *     http://www.apache.org/licenses/LICENSE-2.0
57   *
58   * Unless required by applicable law or agreed to in writing, software
59   * distributed under the License is distributed on an "AS IS" BASIS,
60   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
61   * See the License for the specific language governing permissions and
62   * limitations under the License.
63  -->
64
65</xsl:stylesheet>
66