Reputation: 213
If I have XML like this:
<sample>
<a:element1 xmlns:a="..." />
<b:element2 xmlns:b="..." />
</sample>
it seems that XSL can't find the two child nodes of <sample>
due to the prefixes a:
and b:
.
If I eliminate the two prefixes as well as the namespace declaration, then they are found.
The problem is that I can't do anything about the orginal XML file. So how can I find <element1>
and <element2>
?
Upvotes: 0
Views: 442
Reputation: 35306
This should work:
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:a="http://nsa"
xmlns:b="http://nsb"
version='1.0'
>
<xsl:template match="sample">
<xsl:value-of select="a:element1/@id"/>
<xsl:value-of select="b:element2/@id"/>
</xsl:template>
</xsl:stylesheet>
Upvotes: 1