0
私はこのxsltを使用していますが、テーブル行に別の色を表示するという問題があります。行の色が来なく代替行のための再帰の親タグがXSLTを使用してテーブル行をスタイルする方法
を完了した後にその影響を取得あなたは私
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<html>
<body>
<table border="1">
<xsl:apply-templates select="*"/>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="*[text()]">
<xsl:variable name="altColor">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">#FFFFFF</xsl:when>
<xsl:otherwise>#D3DFEE</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr bgcolor="{$altColor}">
<td>
<xsl:for-each select="ancestor-or-self::*">
<xsl:value-of select="name()" />
<xsl:if test="position()!=last()">
<xsl:text>_</xsl:text>
</xsl:if>
</xsl:for-each>
</td>
<td>
<xsl:value-of select="." />
</td>
</tr>
<xsl:text> </xsl:text>
<xsl:apply-templates select="*"/>
</xsl:template>
</xsl:stylesheet>
入力サンプルXMLは、この
ですが助けてくださいすることができています<?xml-stylesheet type="text/xsl" href="xmltohtmlrecurnewfromAns.xsl"?>
<A>
<B>Text</B>
<C>Text</C>
<D>
<D1>Text</D1>
<D2>
<D3>Text</D3>
<D4>Text</D4>
</D2>
</D>
<E>
<E1>
<E2>
<E3>Text</E3>
</E2>
</E1>
</E>
</A>
おかげで、このXSLTをお試しください – user6496037