xslt1.0 が望ましい
選択した製品保証の量に対して再作成された次の xslt コードがあります。たとえば、5 を選択すると、以下のドロップダウンが 5 回表示されます。1 を超えるものが選択された時点で、それぞれに順番に番号が付けられます。
私が望むのは、同じ項目にのみ番号を付けるということです。たとえば、B を 3 回選択すると、B 1、B 2、B 3 になります。
そしてトリッキーな部分は、ユーザーがフリーテキストを入力できる「その他の」ボックスがあるため、これが別の他のボックスと一致する場合、番号が付けられますが、現時点ではこの部分についてあまり心配していません.
現時点では、次の 5 つの製品を選択するとします。
オプションワン 1、オプションワン 2、オプションツー 3、オプションフォー 4、オプションファイブ 5
私が望むのは、倍数の番号付けのみを取得することです。
オプション 1、オプション 1 2、オプション 2、オプション 4、オプション 5
どんな助けでも大歓迎です
コード:
<xsl:if test="productguarantee!=0">
<xsl:for-each select="productguarantees/productguaranteedata">
<xsl:if test="producttypes/option[@id='A']='selected'">OptionOne</xsl:if>
<xsl:if test="producttypes/option[@id='B']='selected'">OptionTwo</xsl:if>
<xsl:if test="producttypes/option[@id='C']='selected'">OptionThree</xsl:if>
<xsl:if test="producttypes/option[@id='D']='selected'">OptionFour</xsl:if>
<xsl:if test="producttypes/option[@id='E']='selected'">OptionFive</xsl:if>
<xsl:if test="producttypes/option[@id='F']='selected'">OptionSix</xsl:if>
<xsl:if test="producttypes/option[@id='G']='selected'">OptionSeven</xsl:if>
<xsl:if test="producttypes/option[@id='H']='selected'"><xsl:value-of select="otherprodtypebox"/></xsl:if>
<xsl:if test="(../../productguarantee)!='1'">
<xsl:value-of select="position()"/>
</xsl:if>
</xsl:for-each>
</xsl:if>
XML:
<productguarantee>0</productguarantee>
<productguarantees>
<productguaranteedata id="0">
<producttypes>
<option id="A">selected</option>
<option id="B"/>
<option id="C"/>
<option id="D"/>
<option id="E"/>
<option id="F"/>
<option id="G"/>
<option id="H"/>
</producttypes>
<otherprodtypebox/>
</productguaranteedata>
</productguarantees>