- From: Tobias Reif <tobiasreif@pinkjuice.com>
- Date: Mon, 05 May 2003 13:02:39 +0200
- To: public-qt-comments@w3.org
Hi http://www.w3.org/TR/2003/WD-xslt20-20030502/Overview-diff.html#disable-output-escaping "20.2 Disabling Output Escaping Normally, when using the XML, HTML, or XHTML output method, the serializer will escape special characters such as & and < when outputting text and attribute nodes. This ensures that the output is well-formed. However, it is sometimes convenient to be able to produce output that is almost, but not quite well-formed XML; for example, the output may include ill-formed sections which are intended to be transformed into well-formed XML by a subsequent non-XML-aware process. For this reason, XSLT defines a mechanism for disabling output escaping." But generating mal-formed XML is not the only reason for having to rely on shaky d-o-e. Until I can use s.th. like <programlisting> <xsl:serialize format="xml_snippet"> <xsl:copy-of select="$snippet"/> </xsl:serialize> </programlisting> (see http://lists.w3.org/Archives/Public/public-qt-comments/2003Apr/thread.html#54 ) I use <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text> <xsl:copy-of select="$forrest"/> <xsl:text disable-output-escaping="yes">]]></xsl:text> [1] This satisfies a requirement of an IMHO not-too-esoteric usage scenario, and the results are well-formed. (http://www.w3.org/TR/REC-xml.html#NT-CDEnd must be escaped) As long as d-o-e is one workaround for features that are not available in XSLT, I'm not sure if the wording is appropriate. Perhaps adding xsl:serialize is all that's needed. Personally, I don't think I have a use case for d-o-e except that one: I could work around the missing xsl:serialize functionality without d-o-e, but it's one example where d-o-e is used without generating mal-formed XML. I'd be happy about not having to rely on d-o-e. Tobi [1] full (actual and working, but inclomplete) listing: <xsl:template name="serialize"> <xsl:param name="forrest"/> <xsl:choose> <xsl:when test="function-available('saxon:serialize')"> <xsl:variable name="forrest_stripped"> <xsl:apply-templates select="$forrest" mode="strip_ws_only_nodes"/> </xsl:variable> <xsl:copy-of select="saxon:serialize( $forrest_stripped, 'xml_snippets' )"/> </xsl:when> <xsl:otherwise> <!-- no indenting etc --> <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text> <xsl:copy-of select="$forrest"/> <xsl:text disable-output-escaping="yes">]]></xsl:text> </xsl:otherwise> </xsl:choose> </xsl:template> -- http://www.pinkjuice.com/
Received on Monday, 5 May 2003 07:03:42 UTC