Re: [xsl] No of Times Named Template called

Subject: Re: [xsl] No of Times Named Template called
From: "Senthilkumaravelan K" <skumaravelan@xxxxxxxxxxxxxx>
Date: Thu, 13 Mar 2008 12:24:21 -0700
Hi Martin,
Where do I need to capture the count. First part of the loop am
passing  String "S" and "F" to display images.
Am not sure ,where could I capture the count in my XSLT.
Could you please help me in here to show the no of "S" counts and I
can replicate the same for "F" counts.

Thanks,
Senthil



On Thu, Mar 13, 2008 at 12:13 PM, Martin Honnen <Martin.Honnen@xxxxxx> wrote:
>
> Senthilkumaravelan K wrote:
>
>
>  >                                       <xsl:for-each select="report/result">
>  >                                               <tr>
>  >                                                       <xsl:if test="(position() mod 2 = 0)">
>  >                                                               <xsl:attribute name="bgcolor">
>  >                                                                       #FFF8C6
>  >                                                               </xsl:attribute>
>  >                                                       </xsl:if>
>  >                                                       <td>
>  >                                                               <xsl:value-of select="title" />
>  >                                                       </td>
>  >                                                       <td>
>  >                                                               <xsl:if test="req/* or req/text()">
>  > <textarea rows="$ROWS" cols="$COLS" readonly="true"
>  > onClick="alert(this.value)">
>  >                                               <xsl:if test="(position() mod 2 = 0)">
>  >                                                       <xsl:attribute name="style">background-color:   #FFF8C6</xsl:attribute>
>  >                                               </xsl:if>
>  > <xsl:copy-of select="req" />
>  > </textarea>
>  >                                                               </xsl:if>
>  >                                                       </td>
>  >                                                       <td>
>  > <textarea rows="$ROWS" cols="$COLS" >
>  >                                                                                                       <xsl:if test="(position() mod 2 = 0)">
>  >                                                       <xsl:attribute name="style">background-color:   #FFF8C6</xsl:attribute>
>  >                                               </xsl:if>
>  >                                                       <xsl:copy-of select="exp_resp" />
>  >                                                       </textarea>
>  >                                                       </td>
>  >                                                       <td>
>  > <textarea rows="$ROWS" cols="$COLS" >
>  >                                                                                                       <xsl:if test="(position() mod 2 = 0)">
>  >                                                       <xsl:attribute name="style">background-color:   #FFF8C6</xsl:attribute>
>  >                                               </xsl:if>
>  >                                                               <xsl:copy-of select="resp" />
>  >                                                               </textarea>
>  >                                                       </td>
>  >                                                       <td>
>  >                                                               <xsl:choose>
>  >                                                                       <xsl:when
>  > test="normalize-space(resp/fault)=normalize-space(exp_resp/fault)">
>  >                                                                               <xsl:call-template name="STATUS_DETECTION">
>  >                                                                                       <xsl:with-param name="my-param" select="'S'" />
>
>  Here you are passing 'S' and
>
> >                                                                               </xsl:call-template>
>  >                                                                       </xsl:when>
>  >                                                                       <xsl:otherwise>
>  >                                                                               <xsl:call-template name="STATUS_DETECTION">
>  >                                                                                       <xsl:with-param name="my-param" select="'F'" />
>
>  here 'F' but later on where you compute the count
>
> >                                                                               </xsl:call-template>
>  >                                                                       </xsl:otherwise>
>  >                                                               </xsl:choose>
>  >                                                       </td>
>  >                                               </tr>
>  >                                       </xsl:for-each>
>  >
>  >
>  >       <xsl:variable name="result">
>  >      <xsl:for-each select="report/result">
>  >               <xsl:if test="normalize-space(resp/fault)=normalize-space(exp_resp/fault)">
>  >         <xsl:call-template name="STATUS_DETECTION">
>  >            <xsl:with-param name="my-param" select="S" />
>                                                      ^^^^
>  your are not passing in a string (e.g. 'S' or 'F') but an node-set of S
>  elements. There no such elements therefore your template creates failure
>  images and then your count code does not find any and therefore the
>  count is 0.
>
>
>  --
>
>
>
>         Martin Honnen
>         http://JavaScript.FAQTs.com/

Current Thread