{"id":148,"date":"2007-02-25T20:24:51","date_gmt":"2007-02-26T01:24:51","guid":{"rendered":"\/cgi\/wp\/?p=148"},"modified":"2019-12-11T08:34:52","modified_gmt":"2019-12-11T13:34:52","slug":"joomla-and-botmosxslt-xml-feeds-in-portals","status":"publish","type":"post","link":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/?p=148","title":{"rendered":"Joomla And botMosXslt &#8211; XML Feeds In Portals"},"content":{"rendered":"<p>Last night I installed the <a title=\"Joomla\" href=\"http:\/\/www.joomla.org\/\"><strong>Joomla<\/strong><\/a> open source content management system on my local web server and explored its ability to consume XML data feeds (web services, developer APIs, and RSS news feeds). The News Feed module did not allow me to specify a news feed stylesheet, aka XSL file, so I had to look for an extension to add this functionality. I found <a title=\"botMosXslt\" href=\"http:\/\/developer.joomla.org\/sf\/projects\/botmosxslt\"><strong>botMosXslt<\/strong><\/a>, a <em>Mambot allowing processing from xml\/xsl file using xslt processor and render the result in content<\/em>. There were no instructions on how to install it so I will describe how to do so on a Windows web server running PHP 5.0:<\/p>\n<ol>\n<li>Copy <strong>mosxslt.php<\/strong> and <strong>mosxslt.xml <\/strong>to C:\\Inetpub\\wwwroot\\joomla\\mambots\\content<\/li>\n<li>Create directory for XSL files at C:\\Inetpub\\wwwroot\\joomla\\custom\\xml<\/li>\n<li>Select Mambots \/ Site Mambots in Joomla Administrator!<\/li>\n<li>In the Mambot Manager [Site] click the New button<\/li>\n<li>Enter &#8220;botMosXslt&#8221; for the Name field<\/li>\n<li>Leave content selected for the Folder field<\/li>\n<li>Enter &#8220;mosxslt&#8221; for the Mambot file field<\/li>\n<li>Leave Yes radio button selected for Published field<\/li>\n<li>Click the Save button<\/li>\n<\/ol>\n<p><img decoding=\"async\" title=\"Joomla Msmbots\" alt=\"Joomla Msmbots\" src=\"http:\/\/www.williamsportwebdeveloper.com\/images\/blog\/Joomla-Mambots.gif\" \/><\/p>\n<p><img decoding=\"async\" title=\"Site Mambot New\" alt=\"Site Mambot New\" src=\"http:\/\/www.williamsportwebdeveloper.com\/images\/blog\/Site-Mambot-New.gif\" \/><\/p>\n<p>The new botMosXslt mambot should now appear in the list:<\/p>\n<p><img decoding=\"async\" title=\"botMosXslt\" alt=\"botMosXslt\" src=\"http:\/\/www.williamsportwebdeveloper.com\/images\/blog\/botMos.Xslt.gif\" \/><\/p>\n<p>Next I will describe how to use it to display LiveVideo Featured Videos and deal with an error:<\/p>\n<ol>\n<li>Select Content \/ All Content Items in Joomla Administrator!<\/li>\n<li>Click the New button<\/li>\n<li>Enter a title<\/li>\n<li>Enter the title alias<\/li>\n<li>Select a section<\/li>\n<li>Enter &#8220;{mosxslt GetFeaturedVideos.xml FeaturedVideos.xsl} &#8221; as your content<\/li>\n<li>Click the Save button<\/li>\n<li>Copy <strong>GetFeaturedVideos.xml <\/strong>and <strong>FeaturedVideos.xsl <\/strong>to C:\\Inetpub\\wwwroot\\joomla\\custom\\xml<\/li>\n<li>If Fatal error on xslt_create function, edit <strong>mosxslt.php<\/strong><\/li>\n<\/ol>\n<p><img decoding=\"async\" title=\"Joomla Content Menu\" alt=\"Joomla Content Menu\" src=\"http:\/\/www.williamsportwebdeveloper.com\/images\/blog\/Joomla-Content-Menu.gif\" \/><\/p>\n<p>I got a fatal error because I did not have the required libraries to process XSLT using PHP on my system. Fortunately, I had already figured out an alternative way of doing it using the built-in capabilities of PHP 5.0. So if you get the following error add the code I list below it:<\/p>\n<p><strong>Fatal error:<\/strong> Call to undefined function xslt_create() in c:Inetpubwwwrootjoomlamambotscontentmosxslt.php on line 74<\/p>\n<p>Edit the <strong>mosxslt.php<\/strong> file to work around this problem:<\/p>\n<p><code><font color=\"#008000\">\/* \/\/ Process xml<br \/>\n$xh = xslt_create();<br \/>\n$xsltResult = xslt_process($xh,<br \/>\n$fullXmlFilename, $fullXslFilename);<br \/>\nif ($xsltResult)<br \/>\n      $htmlContents = $xsltResult;<br \/>\nelse<br \/>\n      $htmlContents = \"!!! Error in executing XSLT !!!\";<br \/>\nreturn $htmlContents;<br \/>\n*\/<\/font> <font color=\"#008000\"><\/p>\n<p>\/\/ Process xml on Windows<br \/>\n\/\/ edited by Robert S. Robbins 02\/24\/2007<\/font><br \/>\n$xml = new DOMDocument;<br \/>\n$xml->load($fullXmlFilename);<br \/>\n$xsl = new DOMDocument;<br \/>\n$xsl->load($fullXslFilename); <font color=\"#008000\"><br \/>\n\/\/ Configure the transformer<\/font><br \/>\n$proc = new XSLTProcessor;<br \/>\n$proc->importStyleSheet($xsl); <font color=\"#008000\"><br \/>\n\/\/ attach the xsl rules<br \/>\n<\/font>return $proc->transformToXML($xml); <\/code><\/p>\n<p><img decoding=\"async\" title=\"Joomla - LiveVideo Featured Videos\" alt=\"Joomla - LiveVideo Featured Videos\" src=\"http:\/\/www.williamsportwebdeveloper.com\/images\/blog\/Joomla-LiveVideo.jpg\" \/><\/p>\n<p>As you can see I finally got this to work for me. However I did have to use a static XML file rather than pull the current list of LiveVideo Featured Videos using their Developer XPI.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last night I installed the Joomla open source content management system on my local web server and explored its ability to consume XML data feeds (web services, developer APIs, and RSS news feeds). The News Feed module did not allow &hellip; <a href=\"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/?p=148\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=\/wp\/v2\/posts\/148"}],"collection":[{"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=148"}],"version-history":[{"count":2,"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=\/wp\/v2\/posts\/148\/revisions"}],"predecessor-version":[{"id":3426,"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=\/wp\/v2\/posts\/148\/revisions\/3426"}],"wp:attachment":[{"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/williamsportwebdeveloper.com\/cgi\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}