|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30448 exsl:document does not create directories
Submitted: 2004-10-15 16:46 UTC Modified: 2004-10-16 13:21 UTC
From: michiel at trendserver dot nl Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 5.0.2 OS: Debian
Private report: No CVE-ID: None
 [2004-10-15 16:46 UTC] michiel at trendserver dot nl
The PHP5 XSL extension does not seem to create directories when using the <exsl:document> element.

Reproduce code:
XML file (test.xml):
<?xml version="1.0"?>

XSLT file (test.xsl):
<xsl:stylesheet xmlns:xsl="" version="1.0"
<xsl:output method="html" indent="yes" encoding="US-ASCII"/>

<xsl:template match="a">
        <exsl:document href="output/test.html" method="html">
        <xsl:for-each select="b">
                <p><xsl:value-of select="."/></p>

PHP file (exslt.php):
$xml = new DomDocument;

$xsl = new DomDocument;

$proc = new xsltprocessor;

Expected result:
Running 'xsltproc test.xsl test.xml' gives a directory 'output' with file 'test.html' containing '<p>test1</p><p>test2</p>'.

Running 'php exslt.php' should give the same result.

Actual result:
Warning: XSLTProcessor::transformToXml(output/test.html): failed to open stream: No such file or directory in /var/www/experiment/exslt.php on line 10

Warning: No such file or directoryruntime error: file /var/www/experiment/test.xsl element document in /var/www/experiment/exslt.php on line 10

Warning: xsltDocumentElem: unable to save to output/test.html in /var/www/experiment/exslt.php on line 10

Note: when an empty directory 'output' is created before running 'php exslt.php', the file 'test.html' is created correctly.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-16 13:21 UTC]
XSLT (and XML/DOM) uses the PHP Stream implementation 
for accessing/writing files. And they don't create 
directories, if they don't exist... (it's the same as 
fopen("/foo/bar/bla.txt","w"); )

Nothing we can and want to do about that. Implement your 
own streamwrapper in PHP, which creates the directories 
and use that.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat May 15 21:01:25 2021 UTC