Hello,
I have pasted the same as i thought we can make use of any attribute
for building the logic. Thats why i havnt created a sample xml. And I
can only use xslt 1.0. I know with xslt 2.0 it is can be resolved, but
I want some logic in 1.0.
Please help me out....thanks rashi
Date: Thu, 23 Dec 2010 20:49:33 +0530
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: Rashi Bhardwaj <rashi(_dot_)bhardwaj(_at_)gmail(_dot_)com>
Subject: Avoid repition of data
Message-ID:
<AANLkTinu1t5_o_6t3xdrxQzxHL0e-2ksjRWF3vNFjxWQ(_at_)mail(_dot_)gmail(_dot_)com>
Hi All,
Here is my sample xml:
<SALevel Number=3D"1">
<SAItem DDID=3D"2140" Name=3D"060522 Raw Material Sample" Type=3D"1107"
Class=3D"3" TypeName=3D"Application Update">
<SAProperty SAPrpName=3D"Application" SAPrpValue=3D"060522 Raw
Material S=
ample"/>
<SAProperty SAPrpName=3D"EditButton" SAPrpValue=3D""/>
<SAProperty SAPrpName=3D"NewButton" SAPrpValue=3D""/>
</SAItem>
<SAItem DDID=3D"2143" Name=3D"1C Ukraine" Type=3D"1107" Class=3D"3"
TypeName=3D"Application Update">
<SAProperty SAPrpName=3D"Application" SAPrpValue=3D"1C
Ukraine"/>
<SAProperty SAPrpName=3D"EditButton" SAPrpValue=3D""/>
<SAProperty SAPrpName=3D"NewButton" SAPrpValue=3D""/>
</SAItem>
<SAItem DDID=3D"2174" Name=3D"AC" Type=3D"1107" Class=3D"3"
TypeName=3D"Application Update">
<SAProperty SAPrpName=3D"Application" SAPrpValue=3D"AC"/>
<SAProperty SAPrpName=3D"EditButton" SAPrpValue=3D""/>
<SAProperty SAPrpName=3D"NewButton" SAPrpValue=3D""/>
<SALevel Number=3D"3">
<SAItem DDID=3D"11815" Name=3D"Contain / Restricted (1
Account Control
(AC) (All))" Type=3D"1109" Class=3D"3" TypeName=3D"TLCS Update">
<SAProperty SAPrpName=3D"Life Cycle Standards"
SAPrpValue=3D"Contain /
Restricted (1 Account Control (AC) (All))"/>
<SAProperty SAPrpName=3D"Life Cycle State"
SAPrpValue=3D""Contain
/ Restricted"
">
<SARelatedItem DDID=3D"1646"
Type=3D"474" Class=3D"3" TypeName=3D"Life
Cycle State">Contain / Restricted</SARelatedItem>
</SAProperty>
<SAProperty SAPrpName=3D"Functional Area"
SAPrpValue=3D""Project
Cost Control"
">
<SARelatedItem DDID=3D"1633"
Type=3D"461" Class=3D"3" TypeName=3D"Arch
Sub Domain Func Area">Project Cost Control</SARelatedItem>
</SAProperty>
</SAItem>
</SALevel>
</SAItem>
<SAItem DDID=3D"2252" Name=3D"Adobe Acrobat (Pro and Standard)"
Type=3D"1107" Class=3D"3" TypeName=3D"Application Update">
<SAProperty SAPrpName=3D"Application" SAPrpValue=3D"Adobe
Acrobat (Pro
and Standard)"/>
<SAProperty SAPrpName=3D"EditButton" SAPrpValue=3D""/>
<SAProperty SAPrpName=3D"NewButton" SAPrpValue=3D""/>
<SALevel Number=3D"3">
<SAItem DDID=3D"12309" Name=3D"Mainstream / Alternate
(1 Adobe Acrobat
(7.0) (Professional Edition))" Type=3D"1109" Class=3D"3" TypeName=3D"TLCS
Update">
<SAProperty SAPrpName=3D"Life Cycle Standards"
SAPrpValue=3D"Mainstream / Alternate (1 Adobe Acrobat (7.0)
(Professional Edition))"/>
<SAProperty SAPrpName=3D"Life Cycle State"
SAPrpValue=3D""Mainstream / Alternate"
">
<SARelatedItem DDID=3D"1650"
Type=3D"474" Class=3D"3" TypeName=3D"Life
Cycle State">Mainstream / Alternate</SARelatedItem>
</SAProperty>
<SAProperty SAPrpName=3D"Functional Area"
SAPrpValue=3D""Document
Presentation"
">
<SARelatedItem DDID=3D"11037"
Type=3D"461" Class=3D"3" TypeName=3D"Arc=
h
Sub Domain Func Area">Document Presentation</SARelatedItem>
</SAProperty>
</SAItem>
<SAItem DDID=3D"12310" Name=3D"Mainstream / Preferred
(2 Adobe Acrobat
(7.0) (Standard Edition))" Type=3D"1109" Class=3D"3" TypeName=3D"TLCS
Update">
<SAProperty SAPrpName=3D"Life Cycle Standards"
SAPrpValue=3D"Mainstream / Preferred (2 Adobe Acrobat (7.0) (Standard
Edition))"/>
<SAProperty SAPrpName=3D"Life Cycle State"
SAPrpValue=3D""Mainstream / Preferred"
">
<SARelatedItem DDID=3D"1651"
Type=3D"474" Class=3D"3" TypeName=3D"Life
Cycle State">Mainstream / Preferred</SARelatedItem>
</SAProperty>
<SAProperty SAPrpName=3D"Functional Area"
SAPrpValue=3D""Document
Presentation"
">
<SARelatedItem DDID=3D"11037"
Type=3D"461" Class=3D"3" TypeName=3D"Arc=
h
Sub Domain Func Area">Document Presentation</SARelatedItem>
</SAProperty>
</SAItem>
<SAItem DDID=3D"12311" Name=3D"Research / Restricted
(3 Adobe Acrobat
3D (7.0))" Type=3D"1109" Class=3D"3" TypeName=3D"TLCS Update">
<SAProperty SAPrpName=3D"Life Cycle Standards"
SAPrpValue=3D"Research
/ Restricted (3 Adobe Acrobat 3D (7.0))"/>
<SAProperty SAPrpName=3D"Life Cycle State"
SAPrpValue=3D""Research / Restricted"
">
<SARelatedItem DDID=3D"1653"
Type=3D"474" Class=3D"3" TypeName=3D"Life
Cycle State">Research / Restricted</SARelatedItem>
</SAProperty>
<SAProperty SAPrpName=3D"Functional Area"
SAPrpValue=3D""Document
Presentation"
">
<SARelatedItem DDID=3D"11037"
Type=3D"461" Class=3D"3" TypeName=3D"Arc=
h
Sub Domain Func Area">Document Presentation</SARelatedItem>
</SAProperty>
</SAItem>
<SAItem DDID=3D"12312" Name=3D"Mainstream / Preferred
(4 Adobe Acrobat
Elements (7.0))" Type=3D"1109" Class=3D"3" TypeName=3D"TLCS Update">
<SAProperty SAPrpName=3D"Life Cycle Standards"
SAPrpValue=3D"Mainstream / Preferred (4 Adobe Acrobat Elements (7.0))"/>
<SAProperty SAPrpName=3D"Life Cycle State"
SAPrpValue=3D""Mainstream / Preferred"
">
<SARelatedItem DDID=3D"1651"
Type=3D"474" Class=3D"3" TypeName=3D"Life
Cycle State">Mainstream / Preferred</SARelatedItem>
</SAProperty>
<SAProperty SAPrpName=3D"Functional Area"
SAPrpValue=3D""Document
Presentation"
">
<SARelatedItem DDID=3D"11037"
Type=3D"461" Class=3D"3" TypeName=3D"Arc=
h
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=3D"descendant::SAItem[count(SALevel)=3D0]">
<xsl:sort
select=3D"ancestor-or-self::SAItem/SAProperty/@SAPrpValue[1]"
data-type=3D"text"/>
<tr>
<xsl:for-each
select=3D"ancestor-or-self::SAItem/SAProperty[(_at_)SAPrpName !=3D'Invisible'
and @SAPrpName !=3D'##Invisible##']">
<xsl:choose>
<xsl:when
test=3D"./@SAPrpValue=3D''">
<td
style=3D"border:solid 1px
#dddddd;padding-left:5px;background-color: #FFFF33;">
<!--<xsl:apply-templates select=3D"." mode=3D"FormatOutputString"/=
-->
<xsl:text>-</xsl:text>
</td>
</xsl:when>
<xsl:otherwise>
<td
style=3D"border:solid 1px #dddddd;padding-left:5px;">
<!--<xsl:apply-templates select=3D"." mode=3D"FormatOutputString"/=
-->
<xsl:value-of select=3D"./@SAPrpValue"/>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</tr>
</xsl:for-each>
--=20
=A0My problem is for the SAItem with SALevel Number =3D"3", in this case
the SAProperty with SAPrpName=3D"Application" is repeating each time for
each row. For example, for SALevel Number=3D"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
------------------------------
Date: Thu, 23 Dec 2010 16:52:01 +0100
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: =?iso-8859-1?Q?Michael_M=FCller-Hillebrand?=
<mmh(_at_)cap-studio(_dot_)de>
Subject: Re: [xsl] Avoid repition of data
Message-Id: <72E73994-5E0C-45E5-80C3-C2794BB46494(_at_)cap-studio(_dot_)de>
Am 23.12.2010 um 16:19 schrieb Rashi Bhardwaj:
Please help me out....Rashi
It sounds like a grouping problem, but frankly, your example is too hard =
to understand. If you could provide a short example displaying the =
current problem and the desired effect, you would get more useful tips. =
In many cases it helps to remove all attributes that are not connected =
to the problem and change any indenting from tabs or multiple spaces to =
a single space.
- Michael M=FCller-Hillebrand
------------------------------
Date: Thu, 23 Dec 2010 16:41:54 +0000
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: Michael Kay <mike(_at_)saxonica(_dot_)com>
Subject: Re: [xsl] Avoid repition of data
Message-ID: <4D137BD2(_dot_)4070709(_at_)saxonica(_dot_)com>
On 23/12/2010 15:52, Michael Müller-Hillebrand wrote:
Am 23.12.2010 um 16:19 schrieb Rashi Bhardwaj:
Please help me out....Rashi
It sounds like a grouping problem, but frankly, your example is too hard to
understand. If you could provide a short example displaying the current
problem and the desired effect, you would get more useful tips. In many
cases it helps to remove all attributes that are not connected to the
problem and change any indenting from tabs or multiple spaces to a single
space.
- Michael Müller-Hillebrand
Also, grouping problems are very easy to solve with XSLT 2.0, but quite
tricky with XSLT 1.0. So you need to say which you are using.
Michael Kay
Saxonica
--
Rashi Bhardwaj
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--