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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Wed Apr 24 14:01:30 2024 UTC