Re: [xsl] Grouping data at multiple levels (can XSL do this?)

Subject: Re: [xsl] Grouping data at multiple levels (can XSL do this?)
From: Hank Ratzesberger <hankr@xxxxxxxx>
Date: Tue, 28 Jun 2011 21:05:33 -0700
Hi Senthil,

Something like this perhaps, selecting the TAB_ITEMs
that have a ZZBKITEM child with a certain value:

<TAB_ITEM>
<xsl:for-each select="/TAB_ITEM[ZZBKITEM='TYPE1]">
<xsl:copy-of select="."/>
</xsl:for-each>
</TAB_ITEM>

Or maybe copy-of can do all the work:

<OTHER_ITEMS>
<xsl:copy-of select="/TAB_ITEM[ZZBKITEM='TYPE2'"/>
</OTHER_ITEMS>

If you use xsl:for-each-group, the content will be sorted into
the same categories, but you would have to perform the
same select/test again to determine what is actually in the
current-group().

Best,
Hank

On 06/28/2011 06:33 PM, Senthilukvelaan wrote:
Hi All,
I have posted the similar question in the past.   I am also trying to
do something similar in xslt multi-level grouping based
on the value of a node.
<TAB_ITEM>
<ZZBKITEM>TYPE1</ZZBKITEM>
<QTY>1</QTY>
<PRICE>99.00</PRICE>
<EXT_PRICE>99.00</EXT_PRICE>
<ZZBKSUBITEM/>
</TAB_ITEM>
<TAB_ITEM>
<ZZBKITEM>TYPE1</ZZBKITEM>
<QTY>1</QTY>
<PRICE>99.00</PRICE>
<EXT_PRICE>99.00</EXT_PRICE>
<ZZBKSUBITEM/>
</TAB_ITEM>
<TAB_ITEM>
<ZZBKITEM>TYPE2</ZZBKITEM>
<QTY>1</QTY>
<PRICE>99.00</PRICE>
<EXT_PRICE>99.00</EXT_PRICE>
<ZZBKSUBITEM/>
</TAB_ITEM>

Expected output:

<TAB_ITEMS>
<TAB_ITEM>
<BKITEM>TYPE1</BKITEM>
<QTY>1</QTY>
<PRICE>99.00</PRICE>
<EXT_PRICE>99.00</EXT_PRICE>
</TAB_ITEM>
<TAB_ITEM>
<BKITEM>TYPE1</BKITEM>
<QTY>1</QTY>
<PRICE>99.00</PRICE>
<EXT_PRICE>99.00</EXT_PRICE>
</TAB_ITEM>
<TAB_ITEMS>

<OTHER_ITEMS>
<TAB_ITEM>
<BKITEM>TYPE2</BKITEM>
<QTY>1</QTY>
<PRICE>99.00</PRICE>
<EXT_PRICE>99.00</EXT_PRICE>
</TAB_ITEM>
<OTHER_ITEMS>

Please help me, how I do split into two different groups.


Thanks Senthil

-- Louis (Hank) Ratzesberger sopac.ucsd.edu

Current Thread