Search

whoa. i've never messed with the xml feeds. this is freakin' sweet!

and MrBlank, thanks for going through the initial troubles of feeding in a del.icio.us feed =)

Sorry to bump this thread but I’m kinda having issues with the undefined namespace error also.

I’m trying to pull in a standard external wordpress feed, its the ‘media:content’ I’m having an issue with, I’ve added the following namespace to my datasource

name: media
URI: http://search.yahoo.com/mrss

( which is how it is on the wordpress feed )

My Xpath is /rss/channel/item[position() <= 3] just to drill it down a bit

Now when I call media:content[type=’image’]/@url I get an undefined namespace error. The wierd thing is in the xml the /item/ node has all the namespaces on it:

<item xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/">

Now if I add:

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

To the top of my index.xsl page it renders fine but then that puts the xmlns on a div tag half way down the page.

Now its more than likely i’m doing something completely wrong but, any ideas?

To get rid of the namespace in your result output, add exclude-result-prefixes="media" to your xsl:stylesheet element.

Just to clarify on the issue of XML namespaces: the rule is if you need to use a namespace, you need to declare it. Sounds simple enough, but here’s an elaboration..

In your instance, your XML uses the media namespace for the content element, so naturally you’ll need to declare the namespace in your XML (which is generated by the dynamic XML data source). However, in your XSLT—which is also an XML document—need to use the media namespace on your XPath, so you also need to declare it on your XSLT document.

What you did in the latter part, by declaring the media namespace on your XSLT Stylesheet is correct.

Reading through this post, I'm having trouble accessing a youtube xml feed. there are 4 xml namespaces declared on the feed node and I'm not sure how to traverse the tree to get to the entry node.

Can't even get to the nodes via debug either. Anyone got a youtube dynamic_xml DS working correctly?

EDIT: ignore me, made my own namespace and all is well with youtube feed.

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