Repeated namespaces in media RSS

Michael McGinnis's Avatar

Michael McGinnis

14 Jan, 2016 11:40 PM

We wanted to add media thumbnails to our RSS feed. Once we added xmlns:media="http://search.yahoo.com/mrss/", that namespace appears as an attribute for every item in the feed. The hh and xalan namespaces don't do that. See attached files.

  1. Support Staff 1 Posted by Tim on 15 Jan, 2016 03:47 PM

    Tim's Avatar

    Hi Michael,

    When you have a moment, try modifying the first line of your XSLT Format by changing the extension-element-prefixes="date-converter" attribute/value to:

    extension-element-prefixes="date-converter media"
    

    Let me know if that does the trick.

    Thanks

  2. 2 Posted by Michael McGinni... on 15 Jan, 2016 04:16 PM

    Michael McGinnis's Avatar

    But I don't have an `extension-element-prefixes="date-converter"`
    attribute/value
    in my XSLT format....

  3. Support Staff 3 Posted by Tim on 15 Jan, 2016 04:28 PM

    Tim's Avatar

    Bah, sorry - I had switched to another Format in my instance and copied the wrong info. Try adding this attribute to your <xsl:stylesheet> element:

    extension-element-prefixes="media"
    
  4. 4 Posted by Michael McGinni... on 15 Jan, 2016 06:10 PM

    Michael McGinnis's Avatar

    No, that doesn't work. It removes the duplicate namespaces, but also
    removes the `media:thumbnail` node from the RSS feed.

  5. Support Staff 5 Posted by Tim on 15 Jan, 2016 07:16 PM

    Tim's Avatar

    Can you attach your XML output prior to styling it? That will allow for me to play around with it to see if I can get something to work.

    Also, can you verify that this isn't actually causing any problems but that you're just looking for a way to remove those extra attributes?

  6. 6 Posted by Michael McGinni... on 15 Jan, 2016 07:44 PM

    Michael McGinnis's Avatar

    I knew I forgot something. See attached.

    No, this shouldn't actually cause any problems, but we've been surprised before. One of the systems which consume the feed is powered by https://www.apereo.org/projects/uportal

  7. Support Staff 7 Posted by Tim on 15 Jan, 2016 09:49 PM

    Tim's Avatar

    Thanks for attaching that. Try adding this attribute to your <xsl:stylesheet> element:

    exclude-result-prefixes="media"
    
    I think those are the results you're looking for, but I'll wait to hear back.
  8. 8 Posted by Michael McGinni... on 15 Jan, 2016 10:17 PM

    Michael McGinnis's Avatar

    That's much better. The namespace is still repeated for each thumbnail, but the feed is certainly valid according to the W3C.

  9. Support Staff 9 Posted by Tim on 18 Jan, 2016 02:40 PM

    Tim's Avatar

    Good deal. I've tried a few things to see if I can remove that namespace for the <media:thumbnail> element but haven't gotten anything to work yet. If I think of anything over the next few days I'll let you know, but otherwise it sounds like you're in good shape here with the additional exclude-result-prefixes attribute.

    Have a good one!

  10. Tim closed this discussion on 18 Jan, 2016 02:40 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac