RE: [xsl] Grouping / Count Issue

Subject: RE: [xsl] Grouping / Count Issue
From: "Gabriel Osorio" <gosorio@xxxxxxxxxxx>
Date: Thu, 1 Dec 2005 09:55:40 -0500
This formula:

Put Record fields on a string variable separated by commas.
Then, with a loop, call recursive template.
Get first element and the rest.


This example works fine for my own last troubles:

<xsl:template match="Report">
<xsl:variable name="fieldNames">
   ,<xsl:for-each select="GrandTotal/RecordValues/Record/FieldValue">
	<xsl:value-of select="@fieldName"/>,
   </xsl:for-each>x
</xsl:variable>

<xsl:for-each select="Layout/Field[@dataType = 'F']">
	<xsl:call-template name="split">
		<xsl:with-param name="fields" select="$fieldNames"/>
	</xsl:call-template>
</xsl:for-each>

<!--Logic for Field[not(@dataType = 'F')]-->
</xsl:template>


<xsl:template name="split">
  <xsl:param name="fields"/>
  <xsl:variable name="head" select="substring-before($fields,',')"/>
  <xsl:variable name="tail" select="substring-after($fields,',')"/>

  <xsl:if test='$head'> 
		...
  </xsl:if>

  <xsl:if test='$tail'>
	<xsl:call-template name="split">
		<xsl:with-param name="fields" select="$tail"/>
	</xsl:call-template>
  </xsl:if>
</xsl:template>


Gabriel


-----Original Message-----
From: Miraodb [mailto:miraodb@xxxxxxxxxxx] 
Sent: Thursday, December 01, 2005 8:52 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Grouping / Count Issue

> Grouping / Count Issue
> 22986 by: Miraodb
> 22987 by: Gabriel Osorio

> Date: Mon, 28 Nov 2005 11:02:07 -0500
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> From: "Gabriel Osorio" <gosorio@xxxxxxxxxxx>
> Subject: RE: [xsl] Grouping / Count Issue
> Message-ID: <EXCHANGEaeJnKWiQsEH000018fd@xxxxxxxxxxxxxxxxxxxx>
>
> Maybe with:
>
> <!-- F Fields -->
> <xsl:apply-templates select="Field[@dataType = 'F']" />
> <!-- other -->
> <xsl:apply-templates select="Field[not(@dataType = 'F')]" />
>


Hi,

unfortunetely it's not so easy.
the datatype is only referenced in the layout.
so basically, i need to loop into all <fieldValue> elements and look for its
corresponding layout to check if it's a 'F' or 'V'....

It seems like a  slow process, i'm sure it can be done faster than that
using recursion but i can't make it yet.

thanks in advance for your help.
fabrice

Current Thread