Atom 1.0 feed inserted via feed block chooser
Hi there,
I have a regular page that has a feed block chooser along with some other elements, and the block chooser contains an atom 1.0 feed from our blog site. I am having trouble finding the right feed content (see below for details). Is there a sample file somewhere? I am on version 6.4.1. Thanks in advance!
The data definition looks like this:
<system-data-structure> <group
identifier="Main-Content" label="Main Content"> <text
wysiwyg="true" identifier="content" label="Content" /> <asset
type="block" identifier="news-feed" label="Feed" />
</group> </system-data-structure>
And the page rendered in xml looks like this:
<system-data-structure> <Main-Content>
<content><h1>OUR PAGE TITLE</h1></content>
<news-feed> <content> <feed> ... <entry>
... </entry> </feed> </content>
</news-feed> </Main-Content>
</system-data-structure>
I am able to find the "content" node within "news-feed" using
this:
<xsl:template match="Main-Content">
<xsl:apply-templates select="news-feed/content"/>
</xsl:template>
However, I am not able to retrieve the "feed" node at the next
level:
<xsl:template match="Main-Content">
<xsl:apply-templates select="news-feed/content/feed"/>
</xsl:template>
What am I doing wrong?
Thanks,
Allie
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
Support Staff 1 Posted by Tim on 04 Jun, 2010 03:20 PM
Hi Allie,
Are you able to attach your entire XSLT Format along with the XML that is generated for the page in question?
Support Staff 2 Posted by Tim on 04 Jun, 2010 04:09 PM
In your XSLT, try changing line 18 from
<xsl:template match="news-feed/content/feed">
to:<xsl:template match="feed">
Let me know if that helps.
3 Posted by Allie on 04 Jun, 2010 04:31 PM
I am still not getting the content. The changed xslt format is attached.
4 Posted by Kris on 04 Jun, 2010 04:40 PM
I think your issue is that you got a copy-of content, but then refer to its parent news-feed in your apply-templates selector. Try just using select="feed" there and keep your template match="feed" and I think you should be ok. I did not test this but hope it helps.
Kris
5 Posted by Allie on 04 Jun, 2010 06:09 PM
Hi Kris,
The copy-of content refers to a different node, not the "content" node on the "news-feed" stream. I did try what you suggested, but it did not work.
Thanks for trying to help :-)
Support Staff 6 Posted by Tim on 04 Jun, 2010 07:57 PM
I took a closer look at your XML and it looks like the
<feed>
element has a different namespace. You'll probably need to make a few adjustments to your XSLT in order for this to work.First, try adding that namespace to your stylesheet by changing:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
to this:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:z="http://www.w3.org/2005/Atom">
Then, around line 17 or so when you apply-templates on the feed elements, try doing this:
<xsl:apply-templates select="z:feed"/>
7 Posted by Allie on 04 Jun, 2010 08:11 PM
Thanks much, Tim! You are right, I too see that namespace now. It works now by adding the namespace. Is there a sample atom2xml xslt in Cascade? I read it somewhere that there should be a sample file in the installation. I recently updated to 6.4.1 and do not see any such file in the installation. Thanks again.
Support Staff 8 Posted by Tim on 04 Jun, 2010 08:19 PM
Good deal. I'm not aware of any atom2xml samples. The closest thing would probably be our sample rss2xhtml Format, but it would not work for the atom feed in this post. I'll attach it here anyways so you can see.
Tim closed this discussion on 04 Jun, 2010 08:19 PM.
Allie re-opened this discussion on 04 Jun, 2010 08:23 PM
9 Posted by Allie on 04 Jun, 2010 08:23 PM
Thanks for everything!