php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28097 xsl:copy-of not working properly
Submitted: 2004-04-21 19:05 UTC Modified: 2004-04-22 09:25 UTC
From: cross_phil at hotmail dot com Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 4.3.4 OS: Windows XP Pro
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: cross_phil at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-04-21 19:05 UTC] cross_phil at hotmail dot com
Description:
------------
I am using the sablotron xsl extension to transform xml files.  The xsl:copy-of tag does not appear to work properly.  It should copy the tree fragment entirely to the result document but it only copies element tags.  Some of the elements contain text within them (ie: <test>some text</test> would copy as <test></test> without the text).  I am convinced that my code is fine because other transforms that don't use this tag work fine and there are somre pretty crazy transforms that I am trying to run.

Reproduce code:
---------------
My XML data:
<?xml version="1.0"?>
<testroot>
	<testelement>
		<anotherelement>
			some text
		</anotherelement>
		<and_again>
			some more text
		</and_again>
	</testelement>
</testroot>

My XSL sheet:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="testelement">
		<xsl:copy-of select="."/>
	</xsl:template>
</xsl:stylesheet>

My PHP Code:
$xslp = xslt_create();
echo xslt_process($xslp, 'in.xml', 'xsl.xsl');
xslt_free($xslp);


Expected result:
----------------
<testelement>
  <anotherelement>
    some text
  </anotherelement>
  <and_again>
    some more text
  </and_again>
</testelement>


Actual result:
--------------
<?xml version="1.0" encoding="UTF-8" ?> 
<testelement>
  <anotherelement /> 
  <and_again /> 
</testelement>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-22 09:25 UTC] derick@php.net
Can't possibly be a bug in PHP as PHP doesn't handle the transformations. If it is a bug, it's a bug in sablotron so please contact its authors.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 19:01:28 2024 UTC