dotnet xml:
I have recently come to peace with XML namespaces and have switch to
always ripping them out to using them. Has not been too bad but some
things I use to do no longer work.
Given this XML:
<?xml version="1.0"?>
<UpdateManifest xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns="
http://tempuri.org/ updatemanifest">
<UpdateFiles>
<UpdateFile>
<Id>dbc5f337-176e-486f-95f9-83a997256417</Id>
<UpdateFileName>generic3.exe</UpdateFileName>
</UpdateFile>
</UpdateFiles>
<Updates>
<Update>
<Id>f428a425-82d5-484a-8a81-1b0bf7097b77</Id>
<FileId>d2aac5f1-559b-4b47-bddd-a2ed455d251a</FileId>
</Update>
</Updates>
</UpdateManifest>
And this XSL:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:m="
http://tempuri.org/updatemanifest" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="4.0" encoding="iso-8859-1"
indent="no"/>
<xsl:template match="/">
<table class="TableListing" cellpadding="0" cellspacing="0"
border="2">
<xsl:for-each select="/m:UpdateManifest/m:Updates/m:Update">
<tr>
<td>
<xsl:variable name="curfileid" select="m:FileId"/>
<xsl:value-of select="/m:UpdateManifest/m:UpdateFiles/
m:UpdateFile[m:Id = $curfileid]/m:UpdateFileName"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
The select "/m:UpdateManifest/m:UpdateFiles/m:UpdateFile[m:Id =
$curfileid]/m:UpdateFileName" does not return anything.
If I remove xmlns="
http://tempuri.org/updatemanifest" from the xml and
all the "m:" namespace stuff from the XSL, it works as expected
(returns 'generic3.exe'). I am using XslCompiledTransform.
Any ideas what is up here. If not I guess I will go back to being a
namespace stripper.
Nathan