|
Subject: RE: [xsl] getting the counter for a for-each statement From: "Jaime A Stuardo Bahamondes" <jstuardo@xxxxxxxxxxx> Date: Thu, 11 Dec 2003 14:22:36 -0400 |
That doesn't work since the context node isn't the node for the for-each.
This is the complete for-each:
<xsl:for-each select="ROW[count(. | key('tipos', D)[1]) = 1]">
a_valores[<xsl:value-of select="position()-1" />] = new Array(<xsl:value-of select="count(. | key('tipos', A)[1])" />);
a_valores[<xsl:value-of select="position()-1" />][<xsl:value-of select="count(. | key('tipos', D))-1" />] = new Array(2);
a_valores[<xsl:value-of select="position()-1" />][<xsl:value-of select="count(. | key('tipos', D))-1" />][0] = <xsl:value-of select="D" />;
a_valores[<xsl:value-of select="position()-1" />][<xsl:value-of select="count(. | key('tipos', D))-1" />][1] = <xsl:value-of select="D" />;
</xsl:for-each>
This follows the muenchian grouping algorithm. In that case position() gets the parent of ROW since the template is:
<xsl:template match="ficha_tecnica/ROWSET">
The way I have now is by using count(. | key('tipos', D)) and it works, but I think that if I have more data, that process will be inefficient since it has to count the actual nodes for each iteration.
My for-each gets the following:
a_valores[0] = new Array(1);
a_valores[0][0] = new Array(2);
a_valores[0][0][0] = .30726074;
a_valores[0][0][1] = .30726074;
a_valores[1] = new Array(1);
a_valores[1][0] = new Array(2);
a_valores[1][0][0] = .12244368;
a_valores[1][0][1] = .12244368;
a_valores[2] = new Array(1);
a_valores[2][0] = new Array(2);
a_valores[2][0][0] = .4071683;
a_valores[2][0][1] = .4071683;
Jaime
> -----Mensaje original-----
> De: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]En nombre de David
> Carlisle
> Enviado el: Jueves, 11 de Diciembre de 2003 12:32
> Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Asunto: Re: [xsl] getting the counter for a for-each statement
>
>
>
> this has already been answered today in a differentthread.
> <xsl:value-of select="position()"/>
>
>
>
> --
> http://www.dcarlisle.demon.co.uk/matthew
>
> ______________________________________________________________
> __________
> This e-mail has been scanned for all viruses by Star Internet. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ______________________________________________________________
> __________
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] getting the counter for a, David Carlisle | Thread | Re: [xsl] getting the counter for a, David Carlisle |
| Re: [xsl] getting the counter for a, David Carlisle | Date | [xsl] General XSL-FO Advice Sought., Ben Trafford |
| Month |