0

I tried to use a XSLT transformation (below) to a RSS with this type with no result. Why is that ?

<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?>

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:gd="http://schemas.google.com/g/2005" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CUACQXg6fyp7ImA9WhdUFUo.&quot;">

and the structure of it is

<feed>
tags tags tags like <title></title>
<entry><published></published><title></title><content></content>....</entry>
</feed>

XSLT

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:include href="identity.xsl"/>

<xsl:template match="node() | @*">
  <xsl:copy>
    <xsl:apply-templates select="node() | @*" />
  </xsl:copy>
</xsl:template>

<xsl:template match="entry"/>

</xsl:stylesheet>
1
  • This is an FAQ. Duplicate of stackoverflow.com/questions/6111202/…. Also, "no result" is confusing... it sounds like it means "no output", but there should be a result document that is equivalent to the input document, right? Commented Oct 3, 2011 at 11:32

1 Answer 1

1

Your stylesheet is constructed for the default XML namespace (xmlns=""). An RSS feed has the Atom (xmlns="http://www.w3.org/2005/Atom") namespace defined and possibly others if you have nested XML content.

To 'match' anything in that namespace, you need to define it in your stylesheet also. You probably want to define Atom with a prefix like: xmlns:a="http://www.w3.org/2005/Atom". Then your match would become

<xsl:template match="a:entry"/>

Also, the above matches entry but you're not doing anything with it. You probably want it to print out a transformed value when you get an entry but the above is just excluding it from the result.

Sign up to request clarification or add additional context in comments.

2 Comments

I now get it.. Also I see some tags like <app:edited>. How do I match them ? I tried a:app:edited but I got errors
@Giorkouros Namespaces are flat. You can match with simply "app:edited".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.