for-each 문을 두 개 반복하고 있으며 테이블 내에서 가로 형식이 아닌 세로 형식으로 출력하고 싶습니다.XSL for each eacheration
현재는 출력 :
a b c
1 2 3
내가 출력을 원하는 :
a 1
b 2
c 3
수있는 사람의 도움을주십시오?
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no"/>
<xsl:key name="names" match="Niche" use="."/>
<xsl:key name="niche" match="row" use="Niche"/>
<xsl:template match="/">
<table border="1">
<xsl:for-each select="//Niche[generate-id() = generate-id(key('names',.)[1])]">
<xsl:sort select="."/>
<td>
<xsl:value-of select="."/>
</td>
</xsl:for-each>
<td><tr></tr></td>
<xsl:for-each select="//row[generate-id(.)=generate-id(key('niche', Niche)[1])]">
<xsl:sort select="Niche"/>
<td>
<xsl:value-of select="count(key('niche', Niche))"/>
</td>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
샘플 XML :
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="sample.xsl" ?>
<root>
<row>
<Niche>a</Niche>
</row>
<row>
<Niche>b</Niche>
</row>
<row>
<Niche>b</Niche>
</row>
<row>
<Niche>c</Niche>
</row>
<row>
<Niche>c</Niche>
</row>
<row>
<Niche>c</Niche>
</row>
</root>
시작하는 XML의 예를 보여줄 수 있습니까? 스타일 시트의 내용을 보지 않고 디코딩하는 것은 어렵습니다. –