次のような複雑な xml 構造があります。
  <Items>
      <Item>
          <ItemTexts>
            <ItemText>
              <ItemTextsType>type1</ItemTextsType>
              <ItemTextsTypeDesc>description11</ItemTextsTypeDesc>
              <ItemTextsLine>1</ItemTextsLine>
            </ItemText>
            <ItemText>
              <ItemTextsType>type1</ItemTextsType>
              <ItemTextsTypeDesc>description12</ItemTextsTypeDesc>
              <ItemTextsLine>2</ItemTextsLine>
            </ItemText>
            <ItemText>
              <ItemTextsType>type2</ItemTextsType>
              <ItemTextsTypeDesc>description21</ItemTextsTypeDesc>
              <ItemTextsLine>3</ItemTextsLine>
            </ItemText>
            <ItemText>
              <ItemTextsType>type2</ItemTextsType>
              <ItemTextsTypeDesc>description22</ItemTextsTypeDesc>
              <ItemTextsLine>4</ItemTextsLine>
            </ItemText>
          </ItemTexts>
         </Item>
    <Item>
          <ItemTexts>
            <ItemText>
              <ItemTextsType>type1</ItemTextsType>
              <ItemTextsTypeDesc>description11</ItemTextsTypeDesc>
              <ItemTextsLine>1</ItemTextsLine>
            </ItemText>
            <ItemText>
              <ItemTextsType>type1</ItemTextsType>
              <ItemTextsTypeDesc>description12</ItemTextsTypeDesc>
              <ItemTextsLine>2</ItemTextsLine>
            </ItemText>
            <ItemText>
              <ItemTextsType>type2</ItemTextsType>
              <ItemTextsTypeDesc>description21</ItemTextsTypeDesc>
              <ItemTextsLine>3</ItemTextsLine>
            </ItemText>
            <ItemText>
              <ItemTextsType>type2</ItemTextsType>
              <ItemTextsTypeDesc>description22</ItemTextsTypeDesc>
              <ItemTextsLine>4</ItemTextsLine>
            </ItemText>
          </ItemTexts>
         </Item>
<Item>
          <ItemTexts>
            <ItemText>
              <ItemTextsType>type1</ItemTextsType>
              <ItemTextsTypeDesc>description11</ItemTextsTypeDesc>
              <ItemTextsLine>1</ItemTextsLine>
            </ItemText>
            <ItemText>
              <ItemTextsType>type1</ItemTextsType>
              <ItemTextsTypeDesc>description12</ItemTextsTypeDesc>
              <ItemTextsLine>2</ItemTextsLine>
            </ItemText>
            <ItemText>
              <ItemTextsType>type2</ItemTextsType>
              <ItemTextsTypeDesc>description21</ItemTextsTypeDesc>
              <ItemTextsLine>3</ItemTextsLine>
            </ItemText>
            <ItemText>
              <ItemTextsType>type2</ItemTextsType>
              <ItemTextsTypeDesc>description22</ItemTextsTypeDesc>
              <ItemTextsLine>4</ItemTextsLine>
            </ItemText>
          </ItemTexts>
         </Item>
    <Item>
          <ItemTexts>
            <ItemText>
              <ItemTextsType>type3</ItemTextsType>
              <ItemTextsTypeDesc>description31</ItemTextsTypeDesc>
              <ItemTextsLine>1</ItemTextsLine>
            </ItemText>
            <ItemText>
              <ItemTextsType>type3</ItemTextsType>
              <ItemTextsTypeDesc>description32</ItemTextsTypeDesc>
              <ItemTextsLine>2</ItemTextsLine>
            </ItemText>
            <ItemText>
              <ItemTextsType>type2</ItemTextsType>
              <ItemTextsTypeDesc>description21</ItemTextsTypeDesc>
              <ItemTextsLine>3</ItemTextsLine>
            </ItemText>
            <ItemText>
              <ItemTextsType>type2</ItemTextsType>
              <ItemTextsTypeDesc>description22</ItemTextsTypeDesc>
              <ItemTextsLine>4</ItemTextsLine>
            </ItemText>
          </ItemTexts>
         </Item>
    </Items>
それぞれ<Item>にはさらに多くの xml 要素がありますが、ここでは指定しません。
次のような各アイテムで xsl を使用して実行します。
<xsl:for-each select="Items/Item">
<Item>そして、各行に多くの行を持つテーブルを作成します<td>。
ごとに個別にグループ<ItemText>化する方法の例が必要です。<ItemTextsType><Item>
結果を次のような表に配置します。
 <table>
    <%--tr for each Item in Items--%>
    <tr>
        <td>
            some value from xml element according <b> Item1 </b>
        </td>
        <td>
            some more value from xml element according <b> Item1 </b>
        </td>
        <%--
        .
        .
        .
--%>
        <td>
            <table width="100%" dir="ltr">
                <tbody>
                    <tr style="background-color: #507CD1; text-align: center">
                        <td colspan="3" style="font: bold; color: white">
                            Item1
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 35px; font: bold; color: #507CD1;">
                            type1
                        </td>
                    </tr>
                    <tr>
                        <td>
                            description11
                        </td>
                    </tr>
                    <tr>
                        <td>
                            description12
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 35px; font: bold; color: #507CD1;">
                            type2
                        </td>
                    </tr>
                    <tr>
                        <td>
                            description21
                        </td>
                    </tr>
                    <tr>
                        <td>
                            description22
                        </td>
                    </tr>
                </tbody>
            </table>
        </td>
        <td>
            even more value from xml element according <b> Item1 </b>
        </td>
        <%--
        .
        .
        .
        --%>
    </tr>
   <tr>
        <td>
            some value from xml element according <b> Item2 </b>
        </td>
        <td>
            some more value from  xml element according <b> Item2 </b>
        </td>
        <%--
        .
        .
        .
--%>
        <td>
            <table width="100%" dir="ltr">
                <tbody>
                    <tr style="background-color: #507CD1; text-align: center">
                        <td colspan="3" style="font: bold; color: white">
                            Item2
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 35px; font: bold; color: #507CD1;">
                            type1
                        </td>
                    </tr>
                    <tr>
                        <td>
                            description11
                        </td>
                    </tr>
                    <tr>
                        <td>
                            description12
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 35px; font: bold; color: #507CD1;">
                            type2
                        </td>
                    </tr>
                    <tr>
                        <td>
                            description21
                        </td>
                    </tr>
                    <tr>
                        <td>
                            description22
                        </td>
                    </tr>
                </tbody>
            </table>
        </td>
        <td>
            even more value from according <b> Item2 </b>
        </td>
        <%--
        .
        .
        .
        --%>
    </tr>
   <%-- and so on--%>
</table>
ポイントは、それぞれ<Item>に個別のグループ化があり<tr><td><table>  、その内部にグループ化<table>があることです<ItemTextsType>
私は次のようなことを試しました
<xsl:key name="item-texts-type" match="ItemText" use="ItemTextsType" />
<xsl:for-each select="ItemTexts/ItemText[count(. | key('item-texts-type', ItemTextsType)[1]) = 1]">
                        <xsl:sort select="ItemTextsType" />
                        <tr>
                          <td style ="height:35px;font: bold; color:#507CD1;">
                            <xsl:value-of select="ItemTextsType" />
                          </td>
                        </tr>
                        <xsl:for-each select="key('item-texts-type', ItemTextsType)">
                          <tr>
                            <td>
                               <xsl:value-of select="ItemTextsTypeDesc" />
                            </td>
                          </tr>
                        </xsl:for-each>
                      </xsl:for-each>
ただし、非反復ノードでのみ機能します(ノードが 1 つしかない場合<Item>は正常に機能します)。
顧客からのものであるため、xml を変更できません。
助けてください。できるだけ早く必要です。
ありがとうございました !!!!