I am going to be performing an XSLT transformation, transforming XML to an HTML table. It's tabular data, so that's why I'm not using div's. ;)
Anyway, I need to repeat one part of the XSLT for the size of one of my collections. Here's a snippet of the code...
Dim styleSheet = <?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:rh="ReportHub"
exclude-result-prefixes="msxsl"
>
<xsl:output method="html" indent="yes" />
<xsl:template match="rh:Report/rh:Tablix1/rh:Details_Collection">
<xsl:variable name="alternating-row" select="position() mod 2" />
<table class=<%= dataFormatter.formattingTableClass %>>
<xsl:choose>
<xsl:when test="count(rh:Details)=0">
<tr>
<td>There are no items listed for this client</td>
</tr>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="rh:Details">
<tr class=<%= dataFormatter.formattingTRClass %>>
<xsl:variable name="mainrow-position" select="position()" />
<xsl:for-each select="@*">
<%= From x In dataFormatter.dataColumnSettings Select
<xsl:if test="name() != 'colName'">
<xsl:choose>
<xsl:when test="$mainrow-position=1">
<th>
<xsl:value-of select="name()"/>
</th>
</xsl:when>
<xsl:otherwise>
<td>
<xsl:value-of select="."/>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
%>
</xsl:for-each>
</tr>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</table>
</xsl:template>
</xsl:stylesheet>
The problem is that because the XML inside the LINQ query references the xsl namespace, I get:
Error 9 XML namespace prefix 'xsl' is not defined.
Anyone got any clever ideas?
- The inner workings of the XML inside the LINQ query isn't finished, so don't worry about what that looks like.