Note that there are some explanatory texts on larger screens.

plurals
  1. PONumbering of Dropdown Options XSLT
    primarykey
    data
    text
    <p>xslt1.0 preferably</p> <p>I have the following xslt code that is recreated for the amount of productguarantee selected. So say I pick 5 I get the below dropdown 5 times. At the moment when anything over 1 is selected it will number each of them sequentially.</p> <p>What I want is for it to only number items that are the same e.g. if B is selected 3 times it will be B 1, B 2, B 3.</p> <p>And the tricky part is there is an 'other' box where user can type freetext so if this matches another other box then they will be numbered but I'm not too worried about this part for the moment.</p> <p>At the moment say you select 5 products you will get:</p> <p>OptionOne 1, OptionOne 2, OptionTwo 3, OptionFour 4, OptionFive 5</p> <p>What I would like is you get only numbering for multiples e.g.</p> <p>OptionOne 1, Option One 2, OptionTwo, OptionFour, OptionFive</p> <p>Any help greatly appreciated</p> <p>Code:</p> <pre><code>&lt;xsl:if test="productguarantee!=0"&gt; &lt;xsl:for-each select="productguarantees/productguaranteedata"&gt; &lt;xsl:if test="producttypes/option[@id='A']='selected'"&gt;OptionOne&lt;/xsl:if&gt; &lt;xsl:if test="producttypes/option[@id='B']='selected'"&gt;OptionTwo&lt;/xsl:if&gt; &lt;xsl:if test="producttypes/option[@id='C']='selected'"&gt;OptionThree&lt;/xsl:if&gt; &lt;xsl:if test="producttypes/option[@id='D']='selected'"&gt;OptionFour&lt;/xsl:if&gt; &lt;xsl:if test="producttypes/option[@id='E']='selected'"&gt;OptionFive&lt;/xsl:if&gt; &lt;xsl:if test="producttypes/option[@id='F']='selected'"&gt;OptionSix&lt;/xsl:if&gt; &lt;xsl:if test="producttypes/option[@id='G']='selected'"&gt;OptionSeven&lt;/xsl:if&gt; &lt;xsl:if test="producttypes/option[@id='H']='selected'"&gt;&lt;xsl:value-of select="otherprodtypebox"/&gt;&lt;/xsl:if&gt; &lt;xsl:if test="(../../productguarantee)!='1'"&gt; &lt;xsl:value-of select="position()"/&gt; &lt;/xsl:if&gt; &lt;/xsl:for-each&gt; &lt;/xsl:if&gt; </code></pre> <p>XML:</p> <pre><code>&lt;productguarantee&gt;0&lt;/productguarantee&gt; &lt;productguarantees&gt; &lt;productguaranteedata id="0"&gt; &lt;producttypes&gt; &lt;option id="A"&gt;selected&lt;/option&gt; &lt;option id="B"/&gt; &lt;option id="C"/&gt; &lt;option id="D"/&gt; &lt;option id="E"/&gt; &lt;option id="F"/&gt; &lt;option id="G"/&gt; &lt;option id="H"/&gt; &lt;/producttypes&gt; &lt;otherprodtypebox/&gt; &lt;/productguaranteedata&gt; &lt;/productguarantees&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload