homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

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

 9:13 pm on Sep 15, 2003 (gmt 0)

Warning: Sablotron error on line 4: XML parser error 4: not well-formed (invalid token) in c:\dir1\dir2\xml.php on line 7

1: <?php
3: // Allocate a new XSLT processor
4: $xh = xslt_create();
6: // Process the document, returning the result into the $result variable
7: $result = xslt_process
($xh, 'file://C:/dir1/dir2/simple.xml', 'file://C:/dir1/dir2/simple.xsl');
9: xslt_free($xh);

<?xml version="1.0"?>

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="/"/>

I've tried everything - any idea what's wrong? The path's are definitely accurate (if I change them I get a different error saying could not open file)... I'm totally baffled :(



 9:22 pm on Sep 15, 2003 (gmt 0)

I've also tried it without the <?xml version="1.0"?> to no avail...


 12:33 pm on Sep 19, 2003 (gmt 0)

Nobody any idea on this one then? I'm still totally flumoxed. :(

Alternative Future

 12:40 pm on Sep 19, 2003 (gmt 0)

Stab in the dark>

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="

When I work with xsl-fo I use absolute naming for the element name where the xsl:template match="/" matches
simple and the child node is this case is called node



 1:18 pm on Sep 19, 2003 (gmt 0)

but nonetheless the example given is valid XSL(T), no?

Can't see that being it but I'll be sure to try when I get home.

Alternative Future

 1:26 pm on Sep 19, 2003 (gmt 0)

Your probably right joshie76,

Am not fluent in PHP so the problem probably lies there, as for the xsl and xml all looks fine, just that am more used to the absolute naming of the node set.

I would be interested to find out the problem when you get to the bottom of it!

Where is the example located (might have a quick try)?



 1:35 pm on Sep 19, 2003 (gmt 0)

Thanks AF, I'm running it locally at home at the mo' but not much to see, other than that error message, anyway...

I'll be sure to let you know if I crack it - my gut feeling is that something is wrong with php/sablotron on my machine but all this *nix stuff is my achilles heel.



 1:37 pm on Sep 19, 2003 (gmt 0)


I had a few spare minutes so I ran the code you provided in your first post. It works fine for me, prints the value of the first node in the text area.

Are you sure that you are actually using this xsl? In my limited experience of Sablotron it generally throws up these errors when there is non valid xml in the xsl file. I don't mean to sound patronising saying that, on many occasions I've been ready to throw my machine out of the window simply because I was using the wrong (un-modified) xsl file :)

Also, to print the value of both nodes you would use:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="//node">
<xsl:value-of select="."/>


 1:42 pm on Sep 19, 2003 (gmt 0)

<edit>mogwai got it in there: double-check the files being used<edited>

Which version of PHP are you running?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved