[xslt] xsl:copy-of does not preserve disable-output-escaping flag on text nodes



Hi 

-- test.xsl--
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:output method="html" encoding="utf-8"/>
  
  <xsl:template name="x">
        <xsl:text disable-output-escaping="yes">
           &lt;mytag/&gt;
        </xsl:text>
  </xsl:template>
 
  <xsl:template match="/">
        Just call template
        <xsl:call-template name="x"/>;

        Copy-Of result of template call:
        <xsl:variable name="test">
          <xsl:call-template name="x"/>
        </xsl:variable>
        <xsl:copy-of select="$test"/>;
  </xsl:template>

</xsl:stylesheet>
----

% xsltproc test.xsl test.xsl

        Just call template

           <mytag/>
        ;

        Copy-Of result of template call:

           &lt;mytag/&gt;
        ;
  

Following patch will fix this problem:

--- libxslt-1.1.6/libxslt/transform.c.orig      Thu Jun  3 18:40:12 2004
+++ libxslt-1.1.6/libxslt/transform.c   Thu Jun  3 18:41:20 2004
@@ -962,7 +962,7 @@
            break;
         case XML_TEXT_NODE:
         case XML_CDATA_SECTION_NODE:
-           return(xsltCopyTextString(ctxt, insert, node->content, 0));
+           return(xsltCopyTextString(ctxt, insert, node->content,
node->name == xmlStringTextNoenc));
         case XML_ATTRIBUTE_NODE:
            return((xmlNodePtr)
                   xsltCopyProp(ctxt, insert, (xmlAttrPtr) node));




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