Queue (archive)
Usenet Archive
- Joined
- Aug 25, 2006
- Messages
- 4
- Reaction score
- 0
I am trying to transform an XML document (google base feed) where it's root element falls within a namespace. Because of this namespace, my simplistic XSL transformation doesn't (I'm guessing) match/select the correct elements.
Can someone please explain the matching/selection (xpath?) syntax for projecting some of the element's data such as <id> and <openSearch:totalResults>?
The example google base feed is:
<?xml version='1.0'?>
<feed xmlns='http://www.w3.org/2005/Atom' xmlns
penSearch='http:// a9.com/-/spec/opensearchrss/1.0/' xmlns:gm='http://base.google.com/ns- metadata/1.0' xmlns:g='http://base.google.com/ns/1.0' xmlns:batch='http://schemas.google.com/gdata/batch'> <updated>2007-05-25T18:56:07.358Z</updated> <openSearch:totalResults>1</openSearch:totalResults> <openSearch:startIndex>1</openSearch:startIndex> <openSearch:itemsPerPage>25</openSearch:itemsPerPage> <entry> <id>foo1</id> </entry><entry> <id>foo2</id> </entry> </feed>
And a simplistic XSL attempting to select the <id>:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:feed='http://www.w3.org/2005/Atom' version="1.0"<xsl:template match="/"> <xsl:for-each select="feed:entry"> <xsl:value-of select="id" /> </xsl:for-each> </xsl:template> </xsl:stylesheet>
Much appreciated. Thanks,
Can someone please explain the matching/selection (xpath?) syntax for projecting some of the element's data such as <id> and <openSearch:totalResults>?
The example google base feed is:
<?xml version='1.0'?>
<feed xmlns='http://www.w3.org/2005/Atom' xmlns
And a simplistic XSL attempting to select the <id>:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:feed='http://www.w3.org/2005/Atom' version="1.0"<xsl:template match="/"> <xsl:for-each select="feed:entry"> <xsl:value-of select="id" /> </xsl:for-each> </xsl:template> </xsl:stylesheet>
Much appreciated. Thanks,