DesignLiquido / xslt-processor

A JavaScript XSLT processor without native library dependencies
GNU Lesser General Public License v3.0
95 stars 30 forks source link

does not obey 'disable-output-escaping'=yes #30

Closed jpmorris closed 1 year ago

jpmorris commented 4 years ago

I want to turn xml into html. I want to have <!DOCTYPE html> to start the file. Tthe following works with other xml/xsl converters:

xsl:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="yes"/>
    <xsl:template match="/">
        <xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;</xsl:text>
    </xsl:template>
    </xsl:output>
</xsl:stylesheet>

However this module doesn't properly render the DOCTTYPE tag. I get:

&amp;lt;!DOCTYPE html&amp;gt;

So 'disable-output-escaping' isn't being honored because it converts '&' to '& also it does't properly convert < to '<' (but this might be do to the escaping issue).

danpetitt commented 4 years ago

There seems to be code to specifically escape all output which isnt what i want either as I am converting XML to TSV and need to keep my tabs etc

mincerafter42 commented 1 year ago

I will note that disable-output-escaping is an optional feature of the XSLT 1.0 specification; however this does not discount the validity of this issue. I will also note that XSL 1.0 outputs a valid HTML5 doctype legacy string if you instead use <xsl:output method="html" doctype-system="about:legacy-compat"/> (which is also unsupported by xslt-processor), but there are other cases in which disable-output-escaping may be wanted.