Bug #9923 Updated: Wrong behavior of xsl output method 'html'
| From: | jmoore@php.net | Date: | Sat, 28 Apr 2001 19:52:28 +0000 |
| Subject: | Bug #9923 Updated: Wrong behavior of xsl output method 'html' | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-52781@lists.php.net to get a copy of this message | ||
ID: 9923
Updated by: jmoore
Reported By: A.Veremyev@turck.spb.ru
Old-Status: Feedback
Status: Closed
Bug Type: Sablotron XSL
PHP Version: 4.0.3pl1
Assigned To:
Comments:
No feedback (I belive this was found to be a slabtron issue)
closing.
Previous Comments:
---------------------------------------------------------------------------
[2001-03-22 11:49:31] joey@php.net
If I'm reading this correctly, you are complaining about
Sablotron's behavior, not PHP's, right?
PHP Team is not responsible for Sablotron. Please
repor this bug to sablotron team.
---------------------------------------------------------------------------
[2001-03-22 09:41:17] A.Veremyev@turck.spb.ru
The "W3C Recommendation 16 November 1999" says:
-----------------------------
The html output method should not perform escaping for the content of the script and style elements.
For example, a literal result element written in the stylesheet as
<script>if (a < b) foo()</script>
or
<script><![CDATA[if (a < b) foo()]]></script>
should be output as
<script>if (a < b) foo()</script>
[...]
-----------------------------
But Sablotron's xslt_run() function outputs
'if (a < b) foo()'
It also violates other constraints described in the section 16.2 HTML Output Method
(http://www.w3.org/TR/xslt#section-HTML-Output-Method) of the "W3C Recommendation 16 November
1999".
---------------------------------------------------------
Example:
------ test1.php -------------------------------
<?php
$parser = xslt_create();
xslt_run($parser, './test1.xsl', './test1.xml');
print xslt_fetch_result($parser);
xslt_free($parser);
?>
------------------------------------------------
------ test1.xml -------------------------------
<?xml version="1.0"?>
<articles>
<article>
<title>Title 1</title>
<author>Author 1</author>
<comment>
Comment 1
</comment>
</article>
<article>
<title>Title 2</title>
<author>Author 2</author>
<comment>
Comment 2
</comment>
</article>
</articles>
------------------------------------------------
------ test1.xsl -------------------------------
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="articles">
<HEAD>
<TITLE>XML/XSLT test
</TITLE>
<script>if (a < b) foo()</script>
<script><![CDATA[if (a < b) foo()]]></script>
</HEAD>
<body>
<H1>Test</H1>
<hr/>
<table border="1">
<xsl:apply-templates select="article"/>
</table>
</body>
</xsl:template>
<xsl:template match="article">
<tr>
<td width="30%">
<xsl:value-of select="title"/>
</td>
<td width="20%">
<xsl:value-of select="title"/>
</td>
<td width="20%">
<xsl:value-of select="comment"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
------------------------------------------------
------ output ----------------------------------
<html><HEAD><meta http-equiv="Content-Type" content="text/html;
charset=UTF-8"><TITLE>XML/XSLT test
</TITLE><script>if (a < b) foo()</script><script>if (a <
b) foo()</script></HEAD><body><H1>Test</H1><hr><table
border="1"><tr><td width="30%">Title 1</td><td
width="20%">Title 1</td><td width="20%">
Comment 1
</td></tr><tr><td width="30%">Title 2</td><td
width="20%">Title 2</td><td width="20%">
Comment 2
</td></tr></table></body></html>
------------------------------------------------
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9923&edit=2