Giles Hunt
Giles Hunt

Reputation: 531

XSLT conversion of Google base XML

I am trying to convert the following Google Base XML:

http://feeds.omgeu.com/data/xslt/savingsdirect.xml

using this XSLT:

http://feeds.omgeu.com/data/xslt/savingsdirect.xslt

I am struggling to get this working correctly. I have declared the g: namespace but I just can't seem to make any more progress. Any help appreciated.

Thanks

Upvotes: 0

Views: 116

Answers (1)

ThW
ThW

Reputation: 19512

The feed you're parsing is Atom. See the definition in the document element:

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">

But your xslt is missing that namespace. You have to define it in the XSLT:

<xsl:stylesheet 
   version="2.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:xs="http://www.w3.org/2001/XMLSchema" 
   xmlns:fn="http://www.w3.org/2005/xpath-functions" 
   xmlns:omg="http://feeds.omgadmin.co.uk/feeds/ns/1.0/" 
   xmlns:rss="http://feeds.omgeu.com/ns/1.0/" 
   xmlns:g="http://base.google.com/ns/1.0"
   xmlns:atom="http://www.w3.org/2005/Atom">

And use it to fetch the Atom nodes from the XML.

<xsl:template name="itemTemplate" match="atom:entry">

Upvotes: 1

Related Questions