XML을 HTML 테이블로 변환하는 XSLT 변환을 수행하려고합니다. 표 형식의 데이터이므로 div 형식을 사용하지 않습니다. ;)Linq 문을 사용한 XML 리터럴
어쨋거나, 내 컬렉션 중 하나의 크기에 맞게 XSLT의 한 부분을 반복해야합니다.
Error 9 XML namespace prefix 'xsl' is not defined.
누구나 어떤 영리한 아이디어를 가지고 : 여기
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 네임 스페이스를 참조하기 때문에, 내가 얻을입니다 ... 코드의 조각인가?
- LINQ 쿼리 내부의 XML 내부 동작이 완료되지 않았으므로 모양이 걱정되지 않도록하십시오.
이것은 내 대답과 다릅니다. –
같은 대답입니다. 우리는 방금 동시에 그것을 작성했습니다. –
나는 이것이 처음에 추가되었다고 생각했다 ... 내가 틀렸다면, 나쁘다. – GordonB