php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25165 xsl:include via scheme handler fails silently
Submitted: 2003-08-20 02:27 UTC Modified: 2003-08-20 04:20 UTC
From: daniel at med dot usyd dot edu dot au Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 4.3.2 OS: Linux
Private report: No CVE-ID: None
 [2003-08-20 02:27 UTC] daniel at med dot usyd dot edu dot au
Description:
------------
I have defined a scheme called 'xslfolder' that read a directory, and creates a stylesheet on the fly that includes all the mentioned folders. I call xsl:include on this stylesheet, and while it doesn't crash, it doesn't passs through all the templates in the folder full of stylesheets.

This works under PHP 4.2.2 with Sablot 0.71, but fails under PHP 4.3.1 and 4.3.2 and Sablot 0.98 and 1.0.

It doesn't give an actual error; the templates in the subfolder just aren't available.

If I write the include statements to a file, and include that, it works perfectly, but it would be much better to use the more elegant scheme method to do it.

Reproduce code:
---------------
php code:
function includeXSLFolder ($folder) {
        $d = opendir($folder);
        $str = "<?xml version=\"1.0\"?> \n\n <xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n\n";
        while (($file = readdir($d)) !== false) {
                if(strstr($file, ".xsl")!==false && (strstr($file, ".swp")===false) && (strstr($file, ".bak")===false))
                        $str .="<xsl:include href=\""."../".$folder."/".$file."\"/>\n";
        }
        $str .="</xsl:stylesheet>\n";
        return($str);
}
function mySchemeHandler($processor, $scheme, $rest) {
    $rest=substr($rest,1);
    if($scheme == 'xslfolder')
        return(includeXSLFolder($rest));
}

$SchemeHandlerArray["get_all"] = "mySchemeHandler";
xslt_set_scheme_handlers($p,$SchemeHandlerArray);

XSL code:
<xsl:include href="xslfolder:/doctypetemplates"/>


Expected result:
----------------
templates from subfolder should be available

Actual result:
--------------
templates are not available

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 15:01:28 2024 UTC