Search

I have had to add namespaces to my xsl stylesheet to work with RSS feeds, no biggie.

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:media="http://search.yahoo.com/mrss/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:exslt="http://exslt.org/common">

The stylesheet has multiple templates for different actions, only one of which utilises the requirement of the namespaces, yet the output of every template includes these namespaces in a specific div element. I have no idea where this is coming from, and why it is only targeted at a specific div.

Anyone come across this before? I would post xsl, but sadly I'm not allowed.

Try to add the prefixes like so:

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:media="http://search.yahoo.com/mrss/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:exslt="http://exslt.org/common"
    extension-element-prefixes="media dc exslt">

Are you sure about the exsltnamespace? Shouldn't that be exsl?

Are you sure about the exslt namespace? Shouldn't that be exsl?

Good point. ;o)

I did not realise that the extension-element-prefixes="media dc exslt" did that. Will note that down...

...However, it isn't making a bit of difference.

Scratch that, caching issues.

Works a treat Michael, thanks for that!

Are you sure about the exslt namespace? Shouldn't that be exsl?

The shorthandle can be anything you like. xmlns:burp="http://exslt.org/common" is valid too.

Also, try exclude-element-prefixes="media dc exslt".

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details