<xsl:for-each select="A">
<tr>            
<xsl:choose>
<xsl:when test="@a='True'">
<td bgcolor="#FFFF00"><xsl:value-of select="../@e"/></td>
<td bgcolor="#FFFF00"><xsl:value-of select="../@b"/></td>
<td bgcolor="#999999"><xsl:value-of select="@be"/></td>
<xsl:for-each select="T">
<td bgcolor="#FFFF00"><xsl:value-of select="@o"/></td>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<td bgcolor="#999999"><xsl:value-of select="../@e"/></td>
<td bgcolor="#999999"><xsl:value-of select="../@b"/></td>
<td bgcolor="#999999"><xsl:value-of select="@be"/></td>
<xsl:for-each select="T">
<td bgcolor="#999999"><xsl:value-of select="@o"/></td>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</tr>
私の xslt のこの部分は、テーブルの行を作成します。
列は ../@e、../@b、@be、@o です。
A 要素ごとに、テーブルに行を作成します。
3 列目のセルは、何があっても背景色が白です。
したがって、まず最初の 2 列がいっぱいではなく、最初の 2 つの列の最初のセルのみがいっぱいになる必要があります。それらの他のすべてのセルは空です。
しかし、True である A 要素に少なくとも 1 つの @i 属性がある場合、最初の 2 列 (1ST ROW) のセルは、True である @i があることを示すために黄色でなければなりません。
それを理解するのを手伝ってください。ここ数日、悪夢に変わりました。前もって感謝します。
完全な XSLT 変換は次のとおりです。
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<!-- param values may be changed during the XSL Transformation -->
<xsl:param name="shared_item_name"> Animal </xsl:param>
<xsl:param name="description"> Birth </xsl:param>
<xsl:param name="properties"> Kind </xsl:param>
<xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>Problem</title>
        </head>
        <body>
            <xsl:apply-templates/>
        </body>
    </html>
</xsl:template>
<xsl:template match="AA">
    <table border="1" cellspacing="0">
        <tr bgcolor="#9acd32">
            <th> <xsl:value-of select="$shared_item_name" /> </th>
            <th> <xsl:value-of select="$description" /> </th>
            <th> <xsl:value-of select="$properties" /> </th>
        <xsl:for-each select="IRO[position()=1]/P[position()=1]/T">
            <th> <xsl:value-of select="@s" /> </th>
        </xsl:for-each>
        </tr>               
<xsl:for-each select="AI">
    <xsl:for-each select="A">
        <tr>
        <xsl:if test="position()=1">
        <td><xsl:value-of select="../@e"/></td>
        <td bgcolor="#999999"><xsl:value-of select="../@b"/></td>
        </xsl:if>
        <xsl:if test="not(position()=1)">
        <td></td>
        <td></td>
        </xsl:if>
        <td bgcolor="#999999"><xsl:value-of select="@be"/></td>
        <xsl:choose>
        <xsl:when test="@a='True'">
        <xsl:for-each select="T">
        <td bgcolor="#FFFF00"><xsl:value-of select="@o"/></td>
        </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
        <xsl:for-each select="T">
        <td bgcolor="#999999"><xsl:value-of select="@o"/></td>
        </xsl:for-each>
        </xsl:otherwise>
        </xsl:choose>
        </tr>
    </xsl:for-each>
    <xsl:for-each select="AI">
    <xsl:for-each select="A">
        <tr>            
        <xsl:choose>
        <xsl:when test="@i='True'">
        <td bgcolor="#FFFF00"><xsl:value-of select="../@e"/></td>
        <td bgcolor="#FFFF00"><xsl:value-of select="../@b"/></td>
        <td bgcolor="#999999"><xsl:value-of select="@be"/></td>
        <xsl:for-each select="T">
        <td bgcolor="#FFFF00"><xsl:value-of select="@o"/></td>
        </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
        <td bgcolor="#999999"><xsl:value-of select="../@e"/></td>
        <td bgcolor="#999999"><xsl:value-of select="../@b"/></td>
        <td bgcolor="#999999"><xsl:value-of select="@be"/></td>
        <xsl:for-each select="T">
        <td bgcolor="#999999"><xsl:value-of select="@o"/></td>
        </xsl:for-each>
        </xsl:otherwise>
        </xsl:choose>
        </tr>
    </xsl:for-each>
    </xsl:for-each>
    </xsl:for-each>
</table>
</xsl:template>
    </xsl:stylesheet>