xsl-list
[Top] [All Lists]

Re: [xsl] No of Times Named Template called

2008-03-13 11:17:38
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(_dot_)Honnen(_at_)gmx(_dot_)de> 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/

 --~------------------------------------------------------------------
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
 To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
 or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
 --~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--