From:             [EMAIL PROTECTED]
Operating system: FreeBSD 4.7
PHP version:      4.2.3
PHP Bug Type:     XSLT related
Bug description:  xslt_process adds arg: into all document calls on the xsl sheet.

Sablot 0.96 and expat 1.95 installed
php-4.2.3:
./configure --enable-xslt --with-xslt-sablot --with-mysql --with-imap
--with-apxs2=/usr/local/apache2/bin/apxs --with-expat=/usr/local
--with-gettext --with-xml --with-mcrypt --enable-ftp --with-tsrm-pth

Problem: When using xslt_process and a arg:xxx, any xslt document() calls
will point to arg:(and what was in the document call)

Example xsl sheet code:
<xsl:apply-templates
select="document('/websites/xxx/htdocs/xml/messages.xml')//message[@id='nf-comp']/text[@xml:lang='en']"/>

would attempt to open:
arg:/websites/xxx/htdocs/xml/messages.xml

If I call the xsl sheet in from a file then it worked fine.

Origanal Code/Syntax Used:
<?
$xh = xslt_create();
// set xml file to be used with translation
$xmlfile=$GLOBALS["DOCUMENT_ROOT"]."/xml/product.xml";

// load dynamic xsl sheet to be used with translation
$xslstyle="http://".$GLOBALS["SERVER_NAME"]."/styles/product-detail.php?id=".$GLOBALS["HTTP_GET_VARS"]["id";];

$fp = fopen($xslstyle, "r");
$xsltdata["xsldata"]=fread($fp, 500000);
fclose($fp);

// do the translation
$result = xslt_process($xh, $xmlfile, 'arg:xsldata', NULL, $xsltdata);
?>

Fix I used to get around this:
add this line after $xh = xslt_create();
xslt_set_base($xh, "file:///");

Working Code:
<?
$xh = xslt_create();

// Added to fix trying to open arg:(and the file name)
xslt_set_base($xh, "file:///");
// End Added

// set xml file to be used with translation
$xmlfile=$GLOBALS["DOCUMENT_ROOT"]."/xml/product.xml";

// load dynamic xsl sheet to be used with translation
$xslstyle="http://".$GLOBALS["SERVER_NAME"]."/styles/product-detail.php?id=".$GLOBALS["HTTP_GET_VARS"]["id";];

$fp = fopen($xslstyle, "r");
$xsltdata["xsldata"]=fread($fp, 500000);
fclose($fp);

// do the translation
$result = xslt_process($xh, $xmlfile, 'arg:xsldata', NULL, $xsltdata);
?>


-- 
Edit bug report at http://bugs.php.net/?id=20177&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=20177&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=20177&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=20177&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=20177&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=20177&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=20177&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=20177&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=20177&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=20177&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=20177&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20177&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=20177&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=20177&r=isapi

Reply via email to