[uf-dev] hAtom2Atom.xsl PHP implementation

Michael Herrick michael at matterform.com
Mon Apr 12 15:47:03 PDT 2010


I'm wondering if anyone has a PHP 5 implementation of hAtom2Atom. I'm
trying to use the stylesheet, which I got from rbach.priv.at/hAtom/,
with the PHP 5 xsl methods, but I'm just missing something. Probably
something simple. I could keep banging on it, but was hoping someone
could give me a nudge in the right direction.

Here's what I've written so far:

$xsl_doc = new DOMDocument();
$xsl_doc->load('http://mybeautifulride.com/hAtom2Atom.xsl');
$xsl     = new XSLTProcessor();
$xsl->importStyleSheet($xsl_doc);
$html_doc = new DOMDocument();
$html     = file_get_contents('http://mybeautifulride.com/custom_car_blog/');
$html_doc->loadXML($html);
$str = $xsl->transformToXML($html_doc);
echo $str;

But it blows up when I call $xsl->importStyleSheet, like so:


Warning: XSLTProcessor::importStylesheet(http://mybeautifulride.com/uri.xsl)
[xsltprocessor.importstylesheet]: failed to open stream: HTTP request
failed! HTTP/1.0 404 Not Found in
/usr/home/test.voltairepowered.com/voltaire-dev/plugins/news/app.php
on line 67
Warning: XSLTProcessor::importStylesheet()
[xsltprocessor.importstylesheet]: I/O warning : failed to load
external entity "http://mybeautifulride.com/uri.xsl" in
/usr/home/test.voltairepowered.com/voltaire-dev/plugins/news/app.php
on line 67

....followed by quite a few more errors that probably aren't relevant
if I can get the import to work correctly. I think I need to load some
parameters, configure something in the stylesheet, or download some
dependency files. Or something.

Thanks everyone. I've been using Luke Arno's hAtom2Atom proxy but I
think it's time I rolled my own and saved the man some bandwidth. If I
can get this going, I plan to set up another public proxy like Luke's
so other people can benefit.

Michael


More information about the microformats-dev mailing list