• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
4<xsl:output method="xml"/>
5
6  <!-- FileName: output75 -->
7  <!-- Document: http://www.w3.org/TR/xslt -->
8  <!-- DocVersion: 19991116 -->
9  <!-- Section: 16.4 Disable output escaping. -->
10  <!-- Purpose: Spec states:It is an error for output escaping to be disabled
11       for a text node that is used for something other than a text node in the
12       result tree. Thus, it is an error to disable output escaping for an
13       xsl:value-of or xsl:text element that is used to generate the string-value
14       of a comment, processing instruction or attribute node; OUTPUT = XML  -->
15  <!-- Author: Paul Dick -->
16
17<xsl:template match="doc">
18 <xml><xsl:text>&#10;</xsl:text>
19  <out1>
20	<xsl:attribute name="attrib1">
21		<xsl:text disable-output-escaping="no">_&lt;Whoa-No&gt;_</xsl:text>
22	</xsl:attribute>
23	<xsl:attribute name="attrib2">
24		<xsl:value-of select="a" disable-output-escaping="no"/>
25	</xsl:attribute></out1><xsl:text>&#10;</xsl:text>
26
27  <!-- This is the error case. It should come out as d-o-e="no" -->
28  <out2>
29	<xsl:attribute name="attrib3">
30		<xsl:text disable-output-escaping="yes">_&lt;Whoa-Yes&gt;_</xsl:text>
31	</xsl:attribute>
32	<xsl:attribute name="attrib4">
33		<xsl:value-of select="a" disable-output-escaping="yes"/>
34	</xsl:attribute></out2><xsl:text>&#10;</xsl:text>
35
36  <out3>
37	<xsl:value-of select="a" disable-output-escaping="yes"/>
38  </out3><xsl:text>&#10;</xsl:text>
39 </xml>
40</xsl:template>
41
42
43  <!--
44   * Licensed to the Apache Software Foundation (ASF) under one
45   * or more contributor license agreements. See the NOTICE file
46   * distributed with this work for additional information
47   * regarding copyright ownership. The ASF licenses this file
48   * to you under the Apache License, Version 2.0 (the  "License");
49   * you may not use this file except in compliance with the License.
50   * You may obtain a copy of the License at
51   *
52   *     http://www.apache.org/licenses/LICENSE-2.0
53   *
54   * Unless required by applicable law or agreed to in writing, software
55   * distributed under the License is distributed on an "AS IS" BASIS,
56   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
57   * See the License for the specific language governing permissions and
58   * limitations under the License.
59  -->
60
61</xsl:stylesheet>
62