xref: /aosp_15_r20/external/apache-xml/test/tests/conferr/matcherr/matcherr04.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
4  <!-- FileName: MATCHerr04 -->
5  <!-- Document: http://www.w3.org/TR/xpath -->
6  <!-- DocVersion: 19991116 -->
7  <!-- Section: 5.4 -->
8  <!-- Purpose: Put content other than sort or param inside apply-templates. -->
9  <!-- Creator: David Marston -->
10  <!-- ExpectedException: ElemTemplateElement error: Can not add #text to xsl:apply-templates -->
11  <!-- ExpectedException: org.apache.xalan.xslt.XSLProcessorException: ElemTemplateElement error: Can not add #text to xsl:apply-templates -->
12  <!-- ExpectedException: xsl:text is not allowed in this position in the stylesheet! -->
13
14<xsl:template match="doc">
15  <out>
16    <xsl:value-of select="title"/><xsl:text>
17</xsl:text>
18    <xsl:apply-templates select="title">
19      <xsl:sort select="."/>
20      <xsl:text>This should not be inside apply-templates</xsl:text>
21    </xsl:apply-templates>
22  </out>
23</xsl:template>
24
25<xsl:template match="text()"><!-- To suppress empty lines --><xsl:apply-templates/></xsl:template>
26
27<xsl:template match="*[@title]">
28  <xsl:text>Found a node
29</xsl:text>
30  <xsl:apply-templates/>
31</xsl:template>
32
33<xsl:template match="p">
34  <xsl:text>Found a P node; there should not be one!
35</xsl:text>
36  <xsl:apply-templates/>
37</xsl:template>
38
39
40  <!--
41   * Licensed to the Apache Software Foundation (ASF) under one
42   * or more contributor license agreements. See the NOTICE file
43   * distributed with this work for additional information
44   * regarding copyright ownership. The ASF licenses this file
45   * to you under the Apache License, Version 2.0 (the  "License");
46   * you may not use this file except in compliance with the License.
47   * You may obtain a copy of the License at
48   *
49   *     http://www.apache.org/licenses/LICENSE-2.0
50   *
51   * Unless required by applicable law or agreed to in writing, software
52   * distributed under the License is distributed on an "AS IS" BASIS,
53   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
54   * See the License for the specific language governing permissions and
55   * limitations under the License.
56  -->
57
58</xsl:stylesheet>
59