Re: [xml] Libxml2 disable-output-escaping ="yes" produces extra new-line ?



On 10/01/2009, Peter Schlaifer <peter schlaifer gmail com> wrote:
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="text"/>
  <xsl:template match="/" >

 <xsl:text>&lt;hello&gt;</xsl:text><xsl:text>goodbye</xsl:text>
    <xsl:text
 disable-output-escaping="yes">&lt;hello&gt;</xsl:text><xsl:text>
 goodbye</xsl:text>
  </xsl:template>
 </xsl:stylesheet>

 Produces this output:

  <?xml version="1.0"?>
  &lt;hello&gt;goodbye
  <hello>
  goodbye

Well, you are doing something wrong outside of your sample sheet above.

<http://www.w3.org/TR/xslt#disable-output-escaping>
"The text output method ignores the disable-output-escaping attribute,
since it does not perform any output escaping."

The output I get with trunk xsltproc and your sample is:
<hello>goodbye<hello>
goodbye

 This is killing me - any help would be appreciated.
 Also, since the output method is "text", is there any way to
 suppress the <?xml ... > processing instruction?

Look at whatever code you have invoking the transform? The xml
prologue indicates it's still trying to output in xml, not text.

(I didn't get as far as checking for problems d-o-e in libxslt, your
issue - typically - seems to be with the fact you're using it at all.)

Martin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]