468,292 Members | 1,473 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,292 developers. It's quick & easy.

XSL and elements containing "xmlns"

I have an XML doc that looks something like this:

<?xml version="1.0" encoding="utf-8"?>
<elem1>
<elem2 xmlns="http://someurl.com">
<elem3>
<item>some stuff here</item>
<item>some more stuff here</item>
<item>even more stuff here</item>
</elem3>
</elem2>
</elem1>

my XSLT file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" encoding="US-ASCII"/>

<xsl:template match="/">
<html>
<body>
<xsl:for-each select="//elem1/elem2/elem3/item">
<xsl:value-of select="."/>
</xsl:for-each>

hello world
</body>
</html>
</xsl:template>
</xsl:stylesheet>

The problem:

For some reason the for-each does not work with elem2 having an attribute named "xmlns". It only results in an HTML doc which says "hello world." If I change it the name of the attribute to something else, I can spin through quite easily. Through playing around a bit, its like it doesn't recognize elem2 when it has the "xmlns" attribute. What am I missing? The simple solution would be to modify the xml doc, but I don't control what I'm getting. I need to find a way to make it work as-is.

Thoughts?

Thanks,

Tim
Oct 18 '06 #1
0 1243

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Mike Dickens | last post: by
3 posts views Thread by Keith Hill | last post: by
5 posts views Thread by NeilL | last post: by
3 posts views Thread by ano | last post: by
reply views Thread by R. Ian Lee | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.