470,870 Members | 1,442 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,870 developers. It's quick & easy.

Sablotron

this (my) script i's ok:
<?php
$processor=xslt_create();
$result=xslt_process($processor,'xsl/curriculum.xml','xsl/curriculum.xsl');
if (!$result) {
echo xslt_error($processor);
}
else {echo $result;}

xslt_free($processor);
?>
...where files are under c:\PHP directory!

but this don't work:
<?php
$processor=xslt_create();
$path=dirname(__FILE__);
$tree="{$path}/xml/curriculum.xml";
$transform="{$path}/xml/curriculum.xsl";
$result=xslt_process($processor,$tree,$transform);
if (!$result) {
echo xslt_error($processor);
}
else {echo $result;}

xslt_free($processor);
?>
....where files are under the directory where is the script
...and the output is:

Warning: Sablotron error on line 1: XML parser error 4: not well-formed
(invalid token) in D:\siti\prove\3_XML\php\curriculum-sablotron.php
on line 17 (--> $result=xslt_process($processor,$tree,$transform); )

XML parser error 4: not well-formed (invalid token)

where's the problem?
why Sablotron takes files only from the directory of PHP?

thank you!

Simone

Jul 17 '05 #1
4 2570
Simone wrote:
this (my) script i's ok:
<?php
$processor=xslt_create();
$result=xslt_process($processor,'xsl/curriculum.xml','xsl/curriculum.xsl'); if (!$result) {
echo xslt_error($processor);
}
else {echo $result;}

xslt_free($processor);
?>
..where files are under c:\PHP directory!

but this don't work:
<?php
$processor=xslt_create();
$path=dirname(__FILE__);
$tree="{$path}/xml/curriculum.xml";

Why the {$path} ?
I've not seen that before, how about just putting "$path/xml..." ?

Kind Regards,

--
Ian P. Christian
Jul 17 '05 #2
>
Why the {$path} ?


with '{' and '}' you can put a variable into a quoted string!

look and try this example (PHP don't undersand wath's your variables):
<?php
$myname="simone";
echo "$mynameis my name <br>";
echo "$myname is my name <br>";
?>
....and
<?php
$myname="simone";
echo "{$myname}is my name <br>";
?>
infact in this way:
<?php
$processor=xslt_create();
$tree=dirname(__FILE__)."/xml/curriculum.xml";
$transform=dirname(__FILE__)."/xml/curriculum.xsl";
$result=xslt_process($processor,$tree,$transform);
if (!$result) {
echo xslt_error($processor);
}
else {echo $result;}

xslt_free($processor);
?>
Sablotron don't work !

Simone


Jul 17 '05 #3
With total disregard for any kind of safety measures "Simone"
<si*****************@libero.it> leapt forth and uttered:
with '{' and '}' you can put a variable into a quoted string!


But you can do that with double-quoted strings anyway....

--
There is no signature.....
Jul 17 '05 #4
Phil Roberts wrote:
With total disregard for any kind of safety measures "Simone"
<si*****************@libero.it> leapt forth and uttered:
with '{' and '}' you can put a variable into a quoted string!


But you can do that with double-quoted strings anyway....


I Was being rather blonde when I questioned this one ;)

$string = 'moo';
echo "this is a $string"; // will work
echo "this is a $stringwith text right after it"; // won't work
echo "this is a {$string}with text right after it"; // will work

Kind Regards,
--
Ian P. Christian
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Ghislain Benrais | last post: by
1 post views Thread by Christos Margetis | last post: by
reply views Thread by Martin Burkert | last post: by
reply views Thread by Steve Jenkins | last post: by
reply views Thread by Jim Patterson | last post: by
reply views Thread by Sebastian Langer | last post: by
4 posts views Thread by gouranga | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.