I have to hide and display a column for a xml data in xsl. The root element of the xml has many child elements and many subchilds;here the child element will be repeatedly coded with the same subchild elements. The subchild elements are declared as columns and the values of the subchild elements are displayed in rows of xsl with <xsl:for-each> of the child element. In that, if the all the data of a subchild element has null or 0 value the column to be hided. If the same subchild element has atleast one data the column to be displayed the data of the coreesponding and others to be blank. I have used <xsl:choose><xs l:when>case to make the solution. But if there is one data it shows the data to the particular row and other column shifted from the next. Is there any solution. Here is the XML and XSL
XSL
Code:
<ReportDetailssub>
<SlNo>1</SlNo>
<ItemName>AMMONIUM SULPHATE</ItemName>
<ItemDesc>Ammonium Sulphate</ItemDesc>
<DiamondItemDesc>Ammonium Sulphate</DiamondItemDesc>
<ItemDescWithRev>Ammonium Sulphate</ItemDescWithRev>
<NeedByDate>17-JUN-2010</NeedByDate>
<Qty>10.00</Qty>
<UOM>KG</UOM>
<UnitPrice>100.00</UnitPrice>
<UnitPriceSixFractionDigits>100.00</UnitPriceSixFractionDigits>
[B] <MiscPrice1>10.00</MiscPrice1>[/B]
<MiscPrice2>0.00</MiscPrice2>
<MiscPrice3>0.00</MiscPrice3>
<MiscPrice4>200.00</MiscPrice4>
<MiscPrice5>990.00</MiscPrice5>
<AmountSixFractionDigits>1203.53</AmountSixFractionDigits>
<GrossAmount>1000.00</GrossAmount>
<POLineEntity2>
</POLineEntity2>
<POLineEntity3>
</POLineEntity3>
<StoresCopyFlag>
</StoresCopyFlag>
<TaxDetailssub>
<Tax1>
<TaxName>CST 12.5 %:</TaxName>
<Taxdesc>CST 12.5 % On Equipments:</Taxdesc>
<TaxValue>123.75</TaxValue>
</Tax1>
<Tax2>
<TaxName>CST 2 %:</TaxName>
<Taxdesc>CST 2 % :</Taxdesc>
<TaxValue>19.80</TaxValue>
</Tax2>
<Tax3>
<TaxName>Discount:</TaxName>
<Taxdesc>Discount:</Taxdesc>
<TaxValue>1.00</TaxValue>
</Tax3>
<TAXFLAG>Y</TAXFLAG>
</TaxDetailssub>
<TaxDetailssub>
<Tax1>
<TaxName>TDS On Cont 2%:</TaxName>
<Taxdesc>TDS On Cont 2%:</Taxdesc>
<TaxValue>22.69</TaxValue>
</Tax1>
<Tax2>
<TaxName>VAT 4%:</TaxName>
<Taxdesc>VAT 4%:</Taxdesc>
<TaxValue>46.29</TaxValue>
</Tax2>
<Tax3>
<TaxName>VAT 12.5%:</TaxName>
<Taxdesc>VAT 12.5%:</Taxdesc>
<TaxValue>46.29</TaxValue>
</Tax3>
<TAXFLAG>Y</TAXFLAG>
</TaxDetailssub>
<TAXFLAG>Y</TAXFLAG>
<TAXAMOUNT>0</TAXAMOUNT>
<Amount>1203.53</Amount>
</ReportDetailssub>
<ReportDetailssub>
<SlNo>2</SlNo>
<ItemName>BIO-BANTOX</ItemName>
<ItemDesc>Bio-Bantox</ItemDesc>
<DiamondItemDesc>Bio-Bantox</DiamondItemDesc>
<ItemDescWithRev>Bio-Bantox</ItemDescWithRev>
<NeedByDate>17-JUN-2010</NeedByDate>
<UOM>KG</UOM>
<Qty>10.00</Qty>
<UnitPrice>90.00</UnitPrice>
<UnitPriceSixFractionDigits>90.00</UnitPriceSixFractionDigits>
[B]<MiscPrice1>0.00</MiscPrice1>[/B]
<MiscPrice2>0.00</MiscPrice2>
<MiscPrice3>0.00</MiscPrice3>
<MiscPrice4>0.00</MiscPrice4>
<MiscPrice5>900.00</MiscPrice5>
<AmountSixFractionDigits>900.00</AmountSixFractionDigits>
<GrossAmount>900.00</GrossAmount>
<POLineEntity2>
</POLineEntity2>
<POLineEntity3>
</POLineEntity3>
<StoresCopyFlag>
</StoresCopyFlag>
<TaxDetailssub>
<TAXFLAG>N</TAXFLAG>
</TaxDetailssub>
<TAXFLAG>N</TAXFLAG>
<TAXAMOUNT>200.00</TAXAMOUNT>
<Amount>900.00</Amount>
</ReportDetailssub>
<ReportDetailssub>
<SlNo>3</SlNo>
<ItemName>BIOFHOS PFS - 2500</ItemName>
<ItemDesc>Biofhos PFS - 2500</ItemDesc>
<DiamondItemDesc>Biofhos PFS - 2500</DiamondItemDesc>
<ItemDescWithRev>Biofhos PFS - 2500</ItemDescWithRev>
<NeedByDate>17-JUN-2010</NeedByDate>
<UOM>KG</UOM>
<Qty>10.00</Qty>
<UnitPrice>10.00</UnitPrice>
<UnitPriceSixFractionDigits>10.00</UnitPriceSixFractionDigits>
[B]<MiscPrice1>0.00</MiscPrice1>[/B]
<MiscPrice2>0.00</MiscPrice2>
<MiscPrice3>0.00</MiscPrice3>
<MiscPrice4>0.00</MiscPrice4>
<MiscPrice5>100.00</MiscPrice5>
<AmountSixFractionDigits>100.00</AmountSixFractionDigits>
<GrossAmount>100.00</GrossAmount>
<POLineEntity2>
</POLineEntity2>
<POLineEntity3>
</POLineEntity3>
<StoresCopyFlag>
</StoresCopyFlag>
<TaxDetailssub>
<TAXFLAG>N</TAXFLAG>
</TaxDetailssub>
<TAXFLAG>N</TAXFLAG>
<TAXAMOUNT>0.00</TAXAMOUNT>
<Amount>100.00</Amount>
</ReportDetailssub>
<ReportDetailssub>
<SlNo>4</SlNo>
<ItemName>Aspee sprayer</ItemName>
<ItemDesc>Aspee sprayer</ItemDesc>
<DiamondItemDesc>Aspee sprayer</DiamondItemDesc>
<ItemDescWithRev>Aspee sprayer</ItemDescWithRev>
<NeedByDate>17-JUN-2010</NeedByDate>
<UOM>NOS</UOM>
<Qty>10.00</Qty>
<UnitPrice>100.00</UnitPrice>
<UnitPriceSixFractionDigits>100.00</UnitPriceSixFractionDigits>
[B]<MiscPrice1>0.00</MiscPrice1>[/B]
<MiscPrice2>0.00</MiscPrice2>
<MiscPrice3>0.00</MiscPrice3>
<MiscPrice4>0.00</MiscPrice4>
<MiscPrice5>1000.00</MiscPrice5>
<AmountSixFractionDigits>1000.00</AmountSixFractionDigits>
<GrossAmount>1000.00</GrossAmount>
<POLineEntity2>
</POLineEntity2>
<POLineEntity3>
</POLineEntity3>
<StoresCopyFlag>
</StoresCopyFlag>
<TaxDetailssub>
<TAXFLAG>N</TAXFLAG>
</TaxDetailssub>
<TAXFLAG>N</TAXFLAG>
<TAXAMOUNT>0.00</TAXAMOUNT>
<Amount>1000.00</Amount>
</ReportDetailssub>
Code:
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="" height="250px">
<tr valign="top" height="20px">
<td class="styletoprightbottomleftthin" style="width:5%; font-weight: bold; font-family: verdana; font-size: 11px; text-align:center;">S.No</td>
<td class="styletopBottomright" style="width:15%; font-weight: bold; font-family: verdana; font-size: 11px; text-align:center;">Item Code</td>
<td class="styletopBottomright" style="width:20%; font-weight: bold; font-family: verdana; font-size: 11px; text-align:center;">Item Description</td>
<td class="styletopBottomright" style="width:8%; font-weight: bold; font-family: verdana; font-size: 11px; text-align:center;">Quantity</td>
<td class="styletopBottomright" style="width:8%; font-weight: bold; font-family: verdana; font-size: 11px; text-align:center;">Rate Per</td>
<td class="styletopBottomright" style="width:8%; font-weight: bold; font-family: verdana; font-size: 11px; text-align:center;">Rate Rs</td>
<xsl:choose>
<xsl:when test="../ReportDetailssub/MiscPrice1!= '0.00'">
<td class="styletopBottomright" style="width:8%; font-weight: bold; font-family: verdana; font-size: 11px; text-align:center;">Discount</td>
</xsl:when>
<xsl:otherwise>
<xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<!-- <td class="styletopBottomright" style="width:8%; font-weight: bold; font-family: verdana; font-size: 11px; text-align:center;">Discount</td> -->
<td class="styletopBottomright" style="width:10%; font-weight: bold; font-family: verdana; font-size: 11px; text-align:center;">Amount(<xsl:value-of select="../CURRENCY"/>)</td>
<xsl:choose>
<xsl:when test="../ReportDetailssub/MiscPrice4!= '0.00'">
<td class="styletopBottomright" style="width:8%; font-weight: bold; font-family: verdana; font-size: 11px; text-align:center;">Tax Amount</td>
</xsl:when>
<xsl:otherwise>
<xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<!--<td class="styletopBottomright" style="width:8%; font-weight: bold; font-family: verdana; font-size: 11px; text-align:center;">Tax Amount</td>-->
<td class="styletopBottomright" style="width:10%; font-weight: bold; font-family: verdana; font-size: 11px; text-align:center;">Value</td>
</tr>
<xsl:for-each select="../ReportDetailssub">
<tr height="20px">
<td class="styleleftrightthin" style="width:5%; font-weight: ; font-family: verdana; font-size: 11px; align: center;"><xsl:value-of select="SlNo"/></td>
<td class="stylerightalone" style="width:15%; font-weight: ; font-family: verdana; font-size: 11px; align: center;"><xsl:value-of select="ItemName"/></td>
<td class="stylerightalone" style="width:20%; font-weight: ; font-family: verdana; font-size: 11px; align: center;"><xsl:value-of select="ItemDesc"/></td>
<td class="stylerightalone" style="width:8%; font-weight: ; font-family: verdana; font-size: 11px; text-align:right;"><xsl:value-of select="Qty"/></td>
<td class="stylerightalone" style="width:8%; font-weight: ; font-family: verdana; font-size: 11px; text-align:center;"><xsl:value-of select="UOM"/></td>
<td class="stylerightalone" style="width:8%; font-weight: ; font-family: verdana; font-size: 11px; text-align:right;"><xsl:value-of select="UnitPrice"/></td>
<xsl:choose>
<xsl:when test="MiscPrice1!= '0.00'">
<td class="stylerightalone" style="width:8%; font-weight: ; font-family: verdana; font-size: 11px; text-align:right;"><xsl:value-of select="MiscPrice1"/></td>
</xsl:when>
<xsl:otherwise>
<xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<!--<td class="stylerightalone" style="width:8%; font-weight: ; font-family: verdana; font-size: 11px; text-align:right;"><xsl:value-of select="MiscPrice1"/></td>-->
<td class="stylerightalone" style="width:10%; font-weight: ; font-family: verdana; font-size: 11px; text-align:right;"><xsl:value-of select="MiscPrice5"/></td>
<xsl:choose>
<xsl:when test="MiscPrice4!= '0.00'">
<td class="stylerightalone" style="width:8%; font-weight: ; font-family: verdana; font-size: 11px; text-align:right;"><xsl:value-of select="MiscPrice4"/></td>
</xsl:when>
<xsl:otherwise>
<xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<!--<td class="stylerightalone" style="width:8%; font-weight: ; font-family: verdana; font-size: 11px; text-align:right;"><xsl:value-of select="MiscPrice4"/></td>-->
<td class="stylerightalone" style="width:10%; font-weight: ; font-family: verdana; font-size: 11px;text-align:right;">
<input type="text" name="amt" size="10" readonly="true" style="font-weight: ; font-family: verdana; font-size: 11px;text-align:right;border:0px">
<xsl:attribute name="value">
<xsl:value-of select="Amount"/>
</xsl:attribute>
</input>
</td>
</tr>
</xsl:for-each>
Comment