Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XSLT namespace selection (how)?

From: Queue <jensenje@-----.--->
To: NULL
Date: 6/5/2007 6:05:00 PM

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:openSearch='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,



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent