Sablotron error

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
chia
Forum Newbie
Posts: 12
Joined: Fri Jul 12, 2002 8:38 am
Location: Dundee

Sablotron error

Post by chia »

Hi...

I'm working on XML files where are stored in a MySQL database. With PHP I intend to transform these XML with XSLT. After much difficulty, I managed to sort out everything until the portion about xslt_process. The browser
returns:

Warning: Sablotron error on line 2: 'arg:/argument.dtd' not found in /home/httpd/html/ctan/resultworkingcopy2.php on line 91 XSLT processing error: 'arg:/argument.dtd' not found

Anyone have any idea what's going on? I'd appreciate any help I can get on this. Thanks in advance.

Chia
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Well, we would need to see the XSLT file that is throwing up the error.
chia
Forum Newbie
Posts: 12
Joined: Fri Jul 12, 2002 8:38 am
Location: Dundee

Post by chia »

The xslt file would be something like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">

<!--<xsl:template match="ARG">
<html><body>
<xsl:apply-templates/>
</body></html>
</xsl:template>
-->

<!-- This is the title of the page -->
<xsl:template match="CQ">
<b><u>
<xsl:value-of select="."/>
</u></b>
</xsl:template>

<xsl:template match="PROP">
<p/><b>
<xsl:value-of select="."/>
</b><br/>
</xsl:template>


</xsl:stylesheet>
The xml file would be stored in a query and called up via MySQL. It shoul look something like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ARG SYSTEM "argument.dtd">

<ARG>
<SCHEMESET>
<SCHEME>
<NAME>Argument from Position to Know</NAME>
<FORM>
<PREMISE>a is in a position to know whether A is true</PREMISE>
<PREMISE>a asserts that A is true</PREMISE>
<CONCLUSION>A is true</CONCLUSION>
</FORM>
<CQ>Is a in a position to know whether A is true?</CQ>
<CQ>Is a an honest (trustworthy, reliable) source?</CQ>
<CQ>Did a actually assert that A is true?</CQ>
</SCHEME>
</SCHEMESET>

<!-- The Text of the AML-->
<TEXT>If any journalists learn about the invasion, then the newspapers will print the news. And if the newspapers print the news, then the invasion will not be a secret. If the invasion is not a secret, then our troops will not have the advantage of surprise. If we do not have the advantage of surprise, then the enemy will be prepared. And if the enemy is prepared, then we are likely to suffer higher casualties. But no journalists learned about the invasion. Therefore, we are not likely to suffer higher casualties.</TEXT>

<!-- The components of the argument-->
<AU>
<PROP identifier="C" missing="no">
<PROPTEXT offset="367">we are likely to suffer higher casualties</PROPTEXT>
</PROP>
<REFUTATION>
<AU>
<PROP identifier="A" missing="no">
<PROPTEXT offset="468">we are not likely to suffer higher casualties</PROPTEXT>
</PROP>
</AU>
</REFUTATION>
<CA>
<AU>
<PROP identifier="D" missing="no">
<PROPTEXT offset="304">the enemy will be prepared</PROPTEXT>
</PROP>
<CA>
<AU>
<PROP identifier="F" missing="no">
<PROPTEXT offset="202">our troops will not have the advantage of surprise</PROPTEXT>
</PROP>
<CA>
<AU>
<PROP identifier="G" missing="no">
<PROPTEXT offset="171">invasion is not a secret</PROPTEXT>
</PROP>
<LA>
<AU>
<PROP identifier="I" missing="no">
<PROPTEXT offset="0">If any journalists learn about the invasion</PROPTEXT>
</PROP>
<REFUTATION>
<AU>
<PROP identifier="B" missing="no">
<PROPTEXT offset="413"> no journalists learned about the invasion</PROPTEXT>
</PROP>
</AU>
</REFUTATION>
</AU>
<AU>
<PROP identifier="H" missing="no">
<PROPTEXT offset="93">the newspapers print the news</PROPTEXT>
</PROP>
</AU>
</LA>
</AU>
</CA>
</AU>
</CA>
</AU>
</CA>
</AU>
</ARG>
Just in case you might want to look at the .php file as well...:
if (! empty($searchword ))

$query = "SELECT aml FROM arguments WHERE aml LIKE '%$searchword%'";
$result = mysql_query($query)
or die ("Query failed");
$line = mysql_fetch_array($result, MYSQL_ASSOC);

// Create an array
$xml = join($line,'');
$arguments = array('/_xml'=> $xml);

$xsl = "sheet1.xsl";

// Show information about the variable
var_dump($xml);

// Create an XSLT processor
$xslthandler = xslt_create();

// Perform the transformation
$html = xslt_process($xslthandler, 'arg:/_xml', $xsl, NULL, $arguments);

// Detect errors
if (!$html) die ('XSLT processing error: '.xslt_error($xslthandler));

// Destroy the XSLT processor
xslt_free($xslthandler);

// Output the resulting HTML
print "<pre>$html</pre>";
Hope things are clearer now. Thanks again for your time and help. :mrgreen:
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

where do you store argument.dtd ?
chia
Forum Newbie
Posts: 12
Joined: Fri Jul 12, 2002 8:38 am
Location: Dundee

Post by chia »

In the same folder I keep all my .php, .xsl files.

Hope this makes sense
chia
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

just a question because the parser complains about not finding argument.dtd
XSLT processing error: 'arg:/argument.dtd' not found
adrianciobanu
Forum Newbie
Posts: 5
Joined: Tue Jul 30, 2002 5:31 am

Post by adrianciobanu »

regarding to your problem, i'm begining to wander if sablotron supports any including system at all!! Because, the same error you get with dtd, i get with a xsl:include/import in the stylesheet. Maybe it has some weird system of searching for files, i don't know.
As a very don't_do_it_at_home solution, you may embed the dtd in the xml document, i don't know. I can do that with my xsl, but it sucks!!!
Maybe we should raise a BUG to the development team. (In fact i was thinking to take a look in the sources of the xslt extension.)
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

it may also be that sablotron within php_xslt is not aware of the actual php-script path but the location of either the php or apache executable and does not resolve the documents-location properly. If so relatives paths refer to the 'wrong' location. Try absolut paths as test.
adrianciobanu
Forum Newbie
Posts: 5
Joined: Tue Jul 30, 2002 5:31 am

Post by adrianciobanu »

i tried absolute paths like /serials/xslt_file_name.xsl but it didn't work. I also tried ./file_name etc etc ... Maybe the problem is related to their new system, in the php_xslt extension, where you use those arg objects. Anyway it really sucks.
chia
Forum Newbie
Posts: 12
Joined: Fri Jul 12, 2002 8:38 am
Location: Dundee

Post by chia »

Sorted it out but isn't very efficient. :lol:
What I did was use the str_replace function to replace all the <!... blah... blah... blah .dtd> files with a plain "", i.e. nothing and thus won't mess up the script.
It's not efficient but at work out fine for me. 8O
Thanks everyone!
Post Reply