php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29811 XSLTProcessor::transformToXml() doesn't accept DOM-manipulated XML-tree as XSL
Submitted: 2004-08-24 11:25 UTC Modified: 2004-08-25 23:49 UTC
From: php at kaiundina dot de Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 5.0.0 OS: WinXP home - Apache2
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: php at kaiundina dot de
New email:
PHP Version: OS:

 

 [2004-08-24 11:25 UTC] php at kaiundina dot de
Description:
------------
I tried loading a XML-document an a XSL-document into a XSLTProcessor for retrieving a transformed XML.

It works fine as long both source documents come from a file.

Then i tried to modify the XSL-tree using DOM-dunctions resulting in the following algorithm:
1. create XML-Document
2. load XML-document from file
3. create XSL-Document
4. load XSL-document from file
5. modify the XSL-tree // this is the new step
6. create the XSLTProcessor
7. import the XSL-Tree
8. retrieve the resulting XML-string

The resulting XML string is empty ("") then.

I compared the result XSL-Tree after step 5 with the file's content of the working example - they were identical


I found a really ugly workaround:
inserting the following steps

5.1 render the XSL-tree to a XML-string
5.2 called loadXML() for the existing xsl-document, using the result of step 5.1

solved the problem - which showed, that my tree was valid for use as XSL.

maybe i'm wrong, but documentation is rare. Hope there's another solution.

btw: the xsl-extension is declared as experimental - is there a stable version/equivalent available?

thanks in advance

Kai

(hope this issue wasn't mentioned elsewhere)


Reproduce code:
---------------
I found a code similar to mine, having the same problem. I'll post my own if necessary.

http://www.zend.org/phorum/read.php?num=6&id=1575&thread=1552

Expected result:
----------------
XSLTProcessor::transformToXml() produces a valid result XML-String

Actual result:
--------------
XSLTProcessor::transformToXml() produces an empty string

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-24 12:55 UTC] rrichards@php.net
Check that you handle the namespaces correctly when modifying the doc and that this is not just a coding error. If this is not the case, please post link to code.

See http://www.ctindustries.net/dom/domxsl.txt for an example of building an xsl stylesheet manually using dom.
 [2004-08-25 21:42 UTC] php at kaiundina dot de
I finally got a test-script working.

I'll recheck the namespaces in my scripts - my fault.

thanks

sorry for bothering - but good docs are really hard to get.
 [2004-08-25 23:49 UTC] rrichards@php.net
not a bug .... bogus
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 00:01:28 2024 UTC