Numbering of Dropdown Options XSLT -


xslt1.0 preferably

i have following xslt code recreated amount of productguarantee selected. pick 5 below dropdown 5 times. @ moment when on 1 selected number each of them sequentially.

what want number items same e.g. if b selected 3 times b 1, b 2, b 3.

and tricky part there 'other' box user can type freetext if matches other box numbered i'm not worried part moment.

at moment select 5 products get:

optionone 1, optionone 2, optiontwo 3, optionfour 4, optionfive 5

what numbering multiples e.g.

optionone 1, option 1 2, optiontwo, optionfour, optionfive

any appreciated

code:

<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> 

the following not elegant solution, time limited , found changing individual xsl:if statements along lines of:

<xsl:if test="producttypes/option[@id='a']='selected'">     <xsl:text>optionone</xsl:text>     <xsl:if test="         preceding-sibling::productguaranteedata[producttypes/option[@id='a']='selected']         or          following-sibling::productguaranteedata[producttypes/option[@id='a']='selected']                         ">         <xsl:value-of select="position()"/>     </xsl:if> </xsl:if> 

(example product a, have change other xsl:if statements accordingly)

and skipping xsl:if @ end of loop might help.

edit:

<xsl:if test="producttypes/option[@id='a']='selected'">     <xsl:text>optionone</xsl:text>     <xsl:if test="         preceding-sibling::productguaranteedata[producttypes/option[@id='a']='selected']         or          following-sibling::productguaranteedata[producttypes/option[@id='a']='selected']                         ">         <xsl:value-of select="count(preceding-sibling::productguaranteedata[producttypes/option[@id='a']='selected'])+1"/>     </xsl:if> </xsl:if> 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -