php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27981 xsl:copy-of
Submitted: 2004-04-13 12:58 UTC Modified: 2004-04-13 13:35 UTC
From: phpsurf at ifrance dot com Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 5CVS-2004-04-13 (dev) OS: Win2K
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: phpsurf at ifrance dot com
New email:
PHP Version: OS:

 

 [2004-04-13 12:58 UTC] phpsurf at ifrance dot com
Description:
------------
The <xsl:copy-of> transformation on elements called '<link>'.
This is extremely anoying for transforming RSS for example.

Reproduce code:
---------------
Here is the xml file :

<rss version="0.92">
  <channel>
    <item>
      <timestamp>1057489449</timestamp>
      <title>aaa</title>
      <link>bbb</link>
    </item>
  </channel>
</rss>

and the xslt file :

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output    method="html"    indent="yes"    encoding="utf-8"/>
<xsl:template match="/">
  <xsl:copy-of select="*"/>
</xsl:template>
</xsl:stylesheet>


Expected result:
----------------
<rss version="0.92">
  <channel>
    <item>
      <timestamp>1057489449</timestamp>
      <title>aaa</title>
      <link>bbb</link>
    </item>
  </channel>
</rss>

Actual result:
--------------
<rss version="0.92">
  <channel>
    <item>
      <timestamp>1057489449</timestamp>
      <title>aaa</title>
      <link>
    </item>
  </channel>
</rss>

Look at the <link> element ! it doesn't close anymore.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-13 13:35 UTC] amt@php.net
You're setting the stylesheet output method to "html". 
In HTML, <link> is an empty element. You should do <xsl:
output method="xml" ... /> instead.

See 16.2 of http://www.w3.org/TR/xslt
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 19:01:28 2024 UTC