XSLT変換を実行して、XMLをHTMLテーブルに変換します。表形式のデータなので、divを使用していません。;)
とにかく、コレクションの1つのサイズに対して、XSLTの一部を繰り返す必要があります。これがコードの抜粋です...
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>
問題は、LINQクエリ内のXMLがxsl名前空間を参照しているため、次のようになることです。
エラー9XML名前空間プレフィックス'xsl'が定義されていません。
誰かが賢いアイデアを思いついた?
- LINQクエリ内のXMLの内部動作は完了していないため、どのように見えるかについて心配する必要はありません。