| Subject: Grouping elements in table using xsl:fo From: "James Steven" <JSteven@xxxxxxxxxxxxxxxxxxxxx> Date: Tue, 15 Jun 2004 12:15:37 +0100 | 
Hi
I have the following xml:
<x>
	<y>
		<z>
			<A>ff</A>
			<B>gg1</B>
			<C>hh</C>
			<D>ii</D>
			<E>jj</E>
		</z>
	</y>
	<y>
		<z>
			<A>kk</A>
			<B>gg2</B>
			<C>ll</C>
			<D>mm</D>
			<E>nn</E>
		</z>
	</y>
	<y>
		<z>
			<A>tt</A>
			<B>gg3</B>
			<C>uu</C>
			<D>vv</D>
			<E>ww</E>
		</z>
	</y>
	<y>
		<z>
			<A>pp</A>
			<B>gg1</B>
			<C>qq</C>
			<D>rr</D>
			<E>ss</E>
		</z>
	</y>
	<y>
		<z>
			<A>ff</A>
			<B>gg2</B>
			<C>hh</C>
			<D>ii</D>
			<E>jj</E>
		</z>
	</y>
</x>
I would like to create a row for each <z> in a table grouped by the value of
<B>.  For each different value of <B> there would be a heading and on the
rows below each heading each <z> which has the same <B> value.
eg.
				A   C   D   E
                   gg1
				ff  hh  ii  jj
				pp  qq  rr  ss
			 gg2
				kk  ll  mm  nn
				ff  hh  ii  jj
			 gg3
                        tt  uu  vv  ww
So far I have only been able to list all three unique values of <B> in one
row at the start of the table.  To do this I have used:
<fo:table-row>
	<fo:table-cell xsl:use-attribute-sets="x.x.x.x">
		<fo:block xsl:use-attribute-sets="x.x.x.x">
<xsl:apply-templates select="y/z/B[not(. = preceding::B)]"/>
	<xsl:sort select="B"/>
		</fo:block>
	</fo:table-cell>
</fo:table-row>
I have not been able to place each unique value of <B> in a new row and
group each <Z> by <B>.  Also as I am using xsl:fo I have not been using the
Meuchian Method as I am not sure that it is compatible.
Any help would be gratefully received.
Thanks
James Steven
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| set xslt variable from browser url , Jaime Tanna | Thread | Re: [xsl] Grouping elements in tabl, G. Ken Holman | 
| set xslt variable from browser url , Jaime Tanna | Date | Re: [xsl] Grouping elements in tabl, G. Ken Holman | 
| Month |