By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,051 Members | 1,221 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,051 IT Pros & Developers. It's quick & easy.

Sablotron

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
>
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

P: n/a
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

P: n/a
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.