I have an ASP.NET app making two very basic XSL transforms. The first of which works perfectly, and the following XML result is stored into a database. Subsequently that XML is retrieved and put through another transform to be displayed as HTML. This does not work so well, and the issue is very strange...
The node names by themselves are NEVER identified by any 'select,' 'test,' or 'match' attribute. Some simplified XML code and XSL findings are below:
< xml version="1.0" encoding="utf-8" >
<notesCollection xmlns="http://my.fake.namespace.com/generalNote.xsd">
<note>
<title>some title</title>
<body>some text</body>
</note>
</notesCollection>
You would think the following code would be fine...
< xml version="1.0" encoding="utf-8" >
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="notesCollection">
<xsl:for-each select="note">
<xsl:for-each select="*">
write something fancy...
<br />
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
...but you'd be wrong. No element names are ever recognized in any 'select,' 'test,' or 'match.' However, they are recognized if compared as a string against the name() function.
< xml version="1.0" encoding="utf-8" >
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:for-each select="*">
<xsl:if test="name() = 'notesCollection'">
<xsl:for-each select="*">
<xsl:if test="name() = 'note'">
<xsl:for-each select="*">
write something...
<br />
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
The previous code actually works, but implementing such a hack would make me feel dirty inside. Again, the first transform (not written here) is setup almost identically and works fine. But after having the above xml stored in a SQL2000 database (as ntext) everything fails.
I realize there may be some UTF-8 and UTF-16 conflicts being that the .NET string type is locked into UTF-16. But when I tried to make everything match one or the other, there was still no change.
Any ideas

Basic XSLT issue...
Bloom326984
[smack to the forehead]
Thank you...
mike6271
Try this
<xsl:stylesheet version="1.0" xmlns="http://my.fake.namespace.com/generalNote.xsd" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
mNilysg
For the answer look here: http://www.topxml.com/people/bosley/defaultns.asp or here:
Cheers,
Dimitre Novatchev