Subject: [xsl] Avoid repition of data From: Rashi Bhardwaj <rashi.bhardwaj@xxxxxxxxx> Date: Thu, 23 Dec 2010 20:49:33 +0530 |
Hi All, Here is my sample xml: <SALevel Number="1"> <SAItem DDID="2140" Name="060522 Raw Material Sample" Type="1107" Class="3" TypeName="Application Update"> <SAProperty SAPrpName="Application" SAPrpValue="060522 Raw Material Sample"/> <SAProperty SAPrpName="EditButton" SAPrpValue=""/> <SAProperty SAPrpName="NewButton" SAPrpValue=""/> </SAItem> <SAItem DDID="2143" Name="1C Ukraine" Type="1107" Class="3" TypeName="Application Update"> <SAProperty SAPrpName="Application" SAPrpValue="1C Ukraine"/> <SAProperty SAPrpName="EditButton" SAPrpValue=""/> <SAProperty SAPrpName="NewButton" SAPrpValue=""/> </SAItem> <SAItem DDID="2174" Name="AC" Type="1107" Class="3" TypeName="Application Update"> <SAProperty SAPrpName="Application" SAPrpValue="AC"/> <SAProperty SAPrpName="EditButton" SAPrpValue=""/> <SAProperty SAPrpName="NewButton" SAPrpValue=""/> <SALevel Number="3"> <SAItem DDID="11815" Name="Contain / Restricted (1 Account Control (AC) (All))" Type="1109" Class="3" TypeName="TLCS Update"> <SAProperty SAPrpName="Life Cycle Standards" SAPrpValue="Contain / Restricted (1 Account Control (AC) (All))"/> <SAProperty SAPrpName="Life Cycle State" SAPrpValue=""Contain / Restricted" "> <SARelatedItem DDID="1646" Type="474" Class="3" TypeName="Life Cycle State">Contain / Restricted</SARelatedItem> </SAProperty> <SAProperty SAPrpName="Functional Area" SAPrpValue=""Project Cost Control" "> <SARelatedItem DDID="1633" Type="461" Class="3" TypeName="Arch Sub Domain Func Area">Project Cost Control</SARelatedItem> </SAProperty> </SAItem> </SALevel> </SAItem> <SAItem DDID="2252" Name="Adobe Acrobat (Pro and Standard)" Type="1107" Class="3" TypeName="Application Update"> <SAProperty SAPrpName="Application" SAPrpValue="Adobe Acrobat (Pro and Standard)"/> <SAProperty SAPrpName="EditButton" SAPrpValue=""/> <SAProperty SAPrpName="NewButton" SAPrpValue=""/> <SALevel Number="3"> <SAItem DDID="12309" Name="Mainstream / Alternate (1 Adobe Acrobat (7.0) (Professional Edition))" Type="1109" Class="3" TypeName="TLCS Update"> <SAProperty SAPrpName="Life Cycle Standards" SAPrpValue="Mainstream / Alternate (1 Adobe Acrobat (7.0) (Professional Edition))"/> <SAProperty SAPrpName="Life Cycle State" SAPrpValue=""Mainstream / Alternate" "> <SARelatedItem DDID="1650" Type="474" Class="3" TypeName="Life Cycle State">Mainstream / Alternate</SARelatedItem> </SAProperty> <SAProperty SAPrpName="Functional Area" SAPrpValue=""Document Presentation" "> <SARelatedItem DDID="11037" Type="461" Class="3" TypeName="Arch Sub Domain Func Area">Document Presentation</SARelatedItem> </SAProperty> </SAItem> <SAItem DDID="12310" Name="Mainstream / Preferred (2 Adobe Acrobat (7.0) (Standard Edition))" Type="1109" Class="3" TypeName="TLCS Update"> <SAProperty SAPrpName="Life Cycle Standards" SAPrpValue="Mainstream / Preferred (2 Adobe Acrobat (7.0) (Standard Edition))"/> <SAProperty SAPrpName="Life Cycle State" SAPrpValue=""Mainstream / Preferred" "> <SARelatedItem DDID="1651" Type="474" Class="3" TypeName="Life Cycle State">Mainstream / Preferred</SARelatedItem> </SAProperty> <SAProperty SAPrpName="Functional Area" SAPrpValue=""Document Presentation" "> <SARelatedItem DDID="11037" Type="461" Class="3" TypeName="Arch Sub Domain Func Area">Document Presentation</SARelatedItem> </SAProperty> </SAItem> <SAItem DDID="12311" Name="Research / Restricted (3 Adobe Acrobat 3D (7.0))" Type="1109" Class="3" TypeName="TLCS Update"> <SAProperty SAPrpName="Life Cycle Standards" SAPrpValue="Research / Restricted (3 Adobe Acrobat 3D (7.0))"/> <SAProperty SAPrpName="Life Cycle State" SAPrpValue=""Research / Restricted" "> <SARelatedItem DDID="1653" Type="474" Class="3" TypeName="Life Cycle State">Research / Restricted</SARelatedItem> </SAProperty> <SAProperty SAPrpName="Functional Area" SAPrpValue=""Document Presentation" "> <SARelatedItem DDID="11037" Type="461" Class="3" TypeName="Arch Sub Domain Func Area">Document Presentation</SARelatedItem> </SAProperty> </SAItem> <SAItem DDID="12312" Name="Mainstream / Preferred (4 Adobe Acrobat Elements (7.0))" Type="1109" Class="3" TypeName="TLCS Update"> <SAProperty SAPrpName="Life Cycle Standards" SAPrpValue="Mainstream / Preferred (4 Adobe Acrobat Elements (7.0))"/> <SAProperty SAPrpName="Life Cycle State" SAPrpValue=""Mainstream / Preferred" "> <SARelatedItem DDID="1651" Type="474" Class="3" TypeName="Life Cycle State">Mainstream / Preferred</SARelatedItem> </SAProperty> <SAProperty SAPrpName="Functional Area" SAPrpValue=""Document Presentation" "> <SARelatedItem DDID="11037" Type="461" Class="3" TypeName="Arch Sub Domain Func Area">Document Presentation</SARelatedItem> </SAProperty> </SAItem> </SALevel> </SAItem> </SALevel> And here is xsl logic I have used to print it <xsl:for-each select="descendant::SAItem[count(SALevel)=0]"> <xsl:sort select="ancestor-or-self::SAItem/SAProperty/@SAPrpValue[1]" data-type="text"/> <tr> <xsl:for-each select="ancestor-or-self::SAItem/SAProperty[@SAPrpName !='Invisible' and @SAPrpName !='##Invisible##']"> <xsl:choose> <xsl:when test="./@SAPrpValue=''"> <td style="border:solid 1px #dddddd;padding-left:5px;background-color: #FFFF33;"> <!--<xsl:apply-templates select="." mode="FormatOutputString"/>--> <xsl:text>-</xsl:text> </td> </xsl:when> <xsl:otherwise> <td style="border:solid 1px #dddddd;padding-left:5px;"> <!--<xsl:apply-templates select="." mode="FormatOutputString"/>--> <xsl:value-of select="./@SAPrpValue"/> </td> </xsl:otherwise> </xsl:choose> </xsl:for-each> </tr> </xsl:for-each> -- My problem is for the SAItem with SALevel Number ="3", in this case the SAProperty with SAPrpName="Application" is repeating each time for each row. For example, for SALevel Number="3", Application 'Adobe Acrobat (Pro and Standard)' is appearing four times for each nested SAItem, i.e. 1 Adobe Acrobat (7.0), 2 Adobe Acrobat (7.0).....4 Adobe Acrobat (7.0). I want it should appear only for first nested SAItem and not for rest three nested SAItem. Please help me out....Rashi Rashi Bhardwaj
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Dynamic dispatch of funct, Wendell Piez | Thread | Re: [xsl] Avoid repition of data, Michael Müller-Hille |
[xsl] Dynamic dispatch of functions, David Lee | Date | Re: [xsl] Avoid repition of data, Michael Müller-Hille |
Month |