Maybe you should try to output the returned XML from your calendarFeed variable in a <textarea> and copy/paste into an editor so you can see the structure of the returned XML. Maybe that will give you some pointers on how to solve your problem?
I would do it like this: <textarea><xsl:copy-of select="$calendarFeed" /></textarea>
Actually I've already done that and the XPath I'm using reflects the real structure of the XML. I'm just pulling in some sample data from a Google Calendar feed. Here's an example of a feed that I'm using:
XPath expressions behaving strangely after update to 4.5
Ok, so I've just upgraded my site from 4.0.2.1 to 4.5 and I'm experiencing some weird XPath behaviors in my XSLT.
For example, the following works great:
<xsl:for-each select="$calendarFeed/*[name()='feed']/*[name()='entry']">
<xsl:value-of select="name()" /><br/>
</xsl:for-each>
However, the following shows nothing:
<xsl:for-each select="$calendarFeed/feed/entry">
<xsl:value-of select="name()" /><br/>
</xsl:for-each>
Any idea why this is happening? Maybe I've been working too long today and my brain is dead.
Hi Michael
Maybe you should try to output the returned XML from your calendarFeed variable in a <textarea> and copy/paste into an editor so you can see the structure of the returned XML. Maybe that will give you some pointers on how to solve your problem?
I would do it like this: <textarea><xsl:copy-of select="$calendarFeed" /></textarea>
/Jan
Hi Jan,
Actually I've already done that and the XPath I'm using reflects the real structure of the XML. I'm just pulling in some sample data from a Google Calendar feed. Here's an example of a feed that I'm using:
http://www.google.com/calendar/feeds/visioneducenter.com_n8u3g6vo6ifu0ln5ubrs9581s0%40group.calendar.google.com/public/full
Again, the first code snippet works, but I'm not sure why the 2nd doesn't since they essentially do the exact same thing.
Any ideas?
Hi Michael,
It's the Atom namespace in the <feed> tag. You'll need to declare it in your XSLT, (along with the other namespaces) like so:
Then you can reference the XML elements in your XPath statements... i.e.
Let us know if it works for you.
Cheers, Lee.
Hi Lee,
Thanks so much, that works perfectly! I can't believe I forgot to declare the namespaces. Time to get some rest. Thanks again!
No worries Michael, glad you got it sorted. The namespaces thing has caught me out many times!
Cheers, Lee.
Haha, yeah, it's an easy thing to overlook! :)
is working on a reply...