For Programmers: Free Programming Magazines  


Home > Archive > PHP Installation > April 2004 > Re: [PHP-INSTALL] xslt_process









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 Re: [PHP-INSTALL] xslt_process
Ma

2004-04-13, 3:38 pm

hi.

it seems as if this is no install-error, but your xml/xsl is not valid or
has some conflicts with how the php-extensions except the code to be. coupl=
e
of things changed (specially in the xslt-extension). try error-traping
first. maybe this helps:

// define error-traping-function
function xslt_trap_error($parser, $number, $level, $messages) {
if(is_array($messages)) {
$data =3D array();
foreach ($messages as $key =3D> $value) {
$data[$key] =3D $value;
}
echo sprintf("%s in %s on line %d", $data['msg'], $data['URI'],
$data['line']);
} else {
echo $messages;
}
}

// create xslt-processor
$xProc =3D xslt_create();

// set error handler
xslt_set_error_handler($xProc, 'xslt_trap_error');

// define $args and $params as you're used to it
// ...

// do transforming
$out =3D @xslt_process($xProc, 'arg:/_xml', 'arg:/_xsl', null, $args,
$params);
if($out) {
return $out;
} else {
echo '<h2>Error using sablotron</h2>'.$this->debug();
trigger_error('parsing did not work: <pre>'.xslt_error($xProc),
E_USER_ERROR);
}

there is also another alternative: as it seems from your script you do not
need xsl-parameters. so you can alternatively use expat (which is used by
the DomXML-extension) as parser instead of sablotron (which is used by the
xslt-extension).

hth
- ma

# life would be easier if i knew the source code...

> Von: =BDB=EE=B6 =A7=BA=B5th=A3=D1=BD <southen@pipeline.com>
> Antworten an: php-install-return-13234-grillen=3Dabendstille.at@lists.php.n=

et
> Datum: Tue, 13 Apr 2004 11:50:57 -0700
> An: php-install@lists.php.net
> Betreff: [PHP-INSTALL] xslt_process
>=20
> I'm trying to use Sablotron to server-side parse my XML. I've used an RP=

M
> of php 4.3.4 on RH9. I'm using also Plesk 6, a virtual hosting environme=

nt.
>=20
> After installing this RPM, I run the www.domain.com/phpfile.php?x=3Dfile.xm=

l
>=20
> and I get the warning XML parser error 3: no element found in ......... o=

n
> line 85
>=20
> My line 85 says:
>=20
> xslt_process($this->processor, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments=

)
>=20
> so I assume xslt_process is the problem (don't know why, worked in php 4
> .3.3). All different XML & XSL files cause the same error. I would real=

ly
> appreciate it if someone could give me some pointers on a workaround for
> this, I'm desperate!!
>=20
> THANKS!!!!!!!!!!!!!
>=20
> =20
>=20
>=20
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.657 / Virus Database: 422 - Release Date: 4/13/2004
>=20

Sponsored Links







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

Copyright 2008 codecomments.com