Joomla And botMosXslt – XML Feeds In Portals

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 me to specify a news feed stylesheet, aka XSL file, so I had to look for an extension to add this functionality. I found botMosXslt, a Mambot allowing processing from xml/xsl file using xslt processor and render the result in content. 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:

  1. Copy mosxslt.php and mosxslt.xml to C:\Inetpub\wwwroot\joomla\mambots\content
  2. Create directory for XSL files at C:\Inetpub\wwwroot\joomla\custom\xml
  3. Select Mambots / Site Mambots in Joomla Administrator!
  4. In the Mambot Manager [Site] click the New button
  5. Enter “botMosXslt” for the Name field
  6. Leave content selected for the Folder field
  7. Enter “mosxslt” for the Mambot file field
  8. Leave Yes radio button selected for Published field
  9. Click the Save button

Joomla Msmbots

Site Mambot New

The new botMosXslt mambot should now appear in the list:

botMosXslt

Next I will describe how to use it to display LiveVideo Featured Videos and deal with an error:

  1. Select Content / All Content Items in Joomla Administrator!
  2. Click the New button
  3. Enter a title
  4. Enter the title alias
  5. Select a section
  6. Enter “{mosxslt GetFeaturedVideos.xml FeaturedVideos.xsl} ” as your content
  7. Click the Save button
  8. Copy GetFeaturedVideos.xml and FeaturedVideos.xsl to C:\Inetpub\wwwroot\joomla\custom\xml
  9. If Fatal error on xslt_create function, edit mosxslt.php

Joomla Content Menu

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:

Fatal error: Call to undefined function xslt_create() in c:Inetpubwwwrootjoomlamambotscontentmosxslt.php on line 74

Edit the mosxslt.php file to work around this problem:

/* // Process xml
$xh = xslt_create();
$xsltResult = xslt_process($xh,
$fullXmlFilename, $fullXslFilename);
if ($xsltResult)
$htmlContents = $xsltResult;
else
$htmlContents = "!!! Error in executing XSLT !!!";
return $htmlContents;
*/

// Process xml on Windows
// edited by Robert S. Robbins 02/24/2007

$xml = new DOMDocument;
$xml->load($fullXmlFilename);
$xsl = new DOMDocument;
$xsl->load($fullXslFilename);
// Configure the transformer

$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl);
// attach the xsl rules
return $proc->transformToXML($xml);

Joomla - LiveVideo Featured Videos

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.

This entry was posted in General. Bookmark the permalink.

2 Responses to Joomla And botMosXslt – XML Feeds In Portals

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit exceeded. Please complete the captcha once again.