Jump to content

Using A Xsl With A Xml File


Linera

Recommended Posts

I been searching through the different sections of tutorials for an answer.Basicly what I'm trying to do is grab a xml file from my ebay store and link it with a xsl file so I can parse it and have it display at my site.possibly as a table or something similar.

Link to comment
Share on other sites

I been searching through the different sections of tutorials for an answer.Basicly what I'm trying to do is grab a xml file from my ebay store and link it with a xsl file so I can parse it and have it display at my site.possibly as a table or something similar.
1st What language will you be doing that in such like html, asp, php,....?2nd have you look at w3schools tutorial on loading and xml and xsl to then transform an output?There are a few people here on the thread which if you say which language you will be doing it in, could than point you in the best direction.
Link to comment
Share on other sites

html or phpI know how to tell the xml file what xsl file to use, but only when I can actually edit the xml file myself. But my problem is the xml file is on ebay, so I'm unable to change the contents of it.Its auto generated by ebay. It contains the listings on my store.

Link to comment
Share on other sites

In PHP, you can use the XSL extension for that. Note however that the extension must already be enabled. See XSLTProcessor::transformToXML() for an example code (AFTER you turn on the extension!!!).

Link to comment
Share on other sites

<?php// Load the XML source$xml = new DOMDocument;$xml->load('http://esssl.ebay.com/GetListings/barbsbooksandmore');$xsl = new DOMDocument;$xsl->load('style.xsl');// Configure the transformer$proc = new XSLTProcessor;$proc->importStyleSheet($xsl); // attach the xsl rulesecho $proc->transformToXML($xml);?>

I get the error:

Fatal error: Class 'XSLTProcessor' not found in F:\AppServ\www\ebayxml\index.php on line 11

Link to comment
Share on other sites

Like I said: AFTER you enable the XSL extension. The error you get is because the extension is not enabled. See the 6th question from the XSLT FAQ for instructions on that.And that is if it's on your own computer. If it's on a host, ask them to enable it.

Link to comment
Share on other sites

I've set extension_dir = "path to my php folder\ext" and uncommented extension=php_xsl.dllI see get the same error from my last post.
Does the file actually exist on that location? Are you sure you're editing the right php.ini (if you use XAMPP, editing the right php.ini can be confusing)?Create a new file in the same folder (with any name you want), and in it, put:
<?php phpinfo(); ?>

Open this, and see if you can find a header named "xsl" with a table below it. If there isn't, the extension isn't loaded. In that case, check if "Loaded Configuration File" is the same php.ini you edited.

Link to comment
Share on other sites

Info from my php info:xmlXML Support activeXML Namespace Support activelibxml2 Version 2.6.32xmlreaderXMLReader enabledxmlwriterXMLWriter enabled
And there's no table like:
xslXSL enabled libxslt Version 1.1.23 libxslt compiled against libxml Version 2.6.32 EXSLT enabled libexslt Version 0.8.13
?!?Is the "Loaded Configuration File" the same php.ini you edited?
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...