For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > March 2004 > Sablotron xsl include() file not found









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Sablotron xsl include() file not found
Barton

2004-03-26, 11:13 pm

Hi,

I got this problem including an XSL stylesheet (cannot open file...).
I've been Googling around, and it seems a common problem, but the
solutions don't work for me.

This is the PHP code to parse the XSL file:

$xh = xslt_create();
$fileBase = 'file://var/www/html/site123/pages/xsl/';
xslt_set_base($xh, $fileBase);
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $args,
$params);

This is the XSL include tag:
<xsl:include href="login_box.xsl"/>

I'm not sure whether to use file:// or not. I guess it's for Windows
servers only and we're using Apache/Unix with PHP 4.2. But if I don't
use file://, I get another ugly error (arg not found).

Please don't refer me to:
http://be.php.net/manual/en/function.xslt-set-base.php

Been there, and the provided solutions don't work. I also can't use
getcwd () because I'm not referring to the directory the XSL/XML files
are parsed in. Maybe it has something to do with my PHP version? 4.2
instead of 4.3?

Thanks,

Barton
Anthony L. Plunkett

2004-03-26, 11:13 pm

Barton wrote:

> Hi,
>
> I got this problem including an XSL stylesheet (cannot open file...).
> I've been Googling around, and it seems a common problem, but the
> solutions don't work for me.
>
> This is the PHP code to parse the XSL file:
>
> $xh = xslt_create();
> $fileBase = 'file://var/www/html/site123/pages/xsl/';
> xslt_set_base($xh, $fileBase);
> $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $args,
> $params);
>
> This is the XSL include tag:
> <xsl:include href="login_box.xsl"/>
>
> I'm not sure whether to use file:// or not. I guess it's for Windows
> servers only and we're using Apache/Unix with PHP 4.2. But if I don't
> use file://, I get another ugly error (arg not found).
>
> Please don't refer me to:
> http://be.php.net/manual/en/function.xslt-set-base.php
>
> Been there, and the provided solutions don't work. I also can't use
> getcwd () because I'm not referring to the directory the XSL/XML files
> are parsed in. Maybe it has something to do with my PHP version? 4.2
> instead of 4.3?
>
> Thanks,
>
> Barton


Found a similar problem when I was messing around with Sablotron.
Instead of using file:// I just used:

$result=xslt_process($xh, '/home/userid/example.xml',
'/home/userid/example.xsl');

And it worked fine, shame it doesnt' like relative links, but it's only
a minor annoyance. Can't comment on what windows would do though.


Barton

2004-03-26, 11:13 pm

On Wed, 24 Mar 2004 13:37:42 +0000, "Anthony L. Plunkett"
<anthony@thefort.org> wrote:

>Barton wrote:
>
>
>Found a similar problem when I was messing around with Sablotron.
>Instead of using file:// I just used:
>
>$result=xslt_process($xh, '/home/userid/example.xml',
>'/home/userid/example.xsl');
>
>And it worked fine, shame it doesnt' like relative links, but it's only
>a minor annoyance. Can't comment on what windows would do though.
>


Hi Anthony, you don't seem to understand me. The problems I got have
nothing to do with arg:/_xml or arg:/_xsl. That works just fine, the
parser correctly finds the XSL and XML files.

Now the problem starts when using the XSL tag <include> in the XSL
document that is parsed. A nice detail is that this XSL file is
located in the same directory as the main XSL file which is correctly
found!

Grtz,

Barton
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com