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 11:14:49 -0700
Hi Martin,
Thanks for the input.
I am getting zero for all the inputs.
My XML Data looks like this

<req bid="38180" ><mydata>Senthil</mydata></req>
<exp_resp><code>OK</code><message>Test1</message><fault></fault></exp_resp>
<resp><code>OK</code><message> Test1 </message><fault>test</fault></resp>
</result>
Could you please ,what am I doing wrong in here?


<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" />
        </xsl:call-template>
</xsl:if>
     </xsl:for-each>
</xsl:variable>	
<xsl:variable name="no-of-S" xmlns:exslt="http://exslt.org/common";
select="count(exslt:node-set($result)/img[contains(@src, 'success')])"
/>

<xsl:value-of select="$no-of-S" />

<xsl:template name="STATUS_DETECTION">
		<xsl:param name="my-param" />
		<xsl:choose>
			<xsl:when test="$my-param='S'">
		<img src="../img/success.png"/>
			</xsl:when>
			<xsl:otherwise>
		<img src="../img/failure.png"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

On Thu, Mar 13, 2008 at 10:57 AM, Martin Honnen <Martin.Honnen@xxxxxx> wrote:
> Senthilkumaravelan K wrote:
>
>  > I use java XALAN processor.
>
>  I think Xalan supports the EXSLT extension function node-set so you can try
>
>
>
>  <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" />
>          </xsl:call-template>
>  </xsl:if>
>       </xsl:for-each>
>  </xsl:variable>
>  <xsl:variable name="no-of-S"
>    xmlns:exslt="http://exslt.org/common";
>  select="count(exslt:node-set($result)/img[contains(@src, 'success')])" />
>
>
>  No of S<xsl:value-of select="$no-of-S" />
>
>  --
>
>
>
>         Martin Honnen
>         http://JavaScript.FAQTs.com/

Current Thread