Re: [xsl] for-each issue

Subject: Re: [xsl] for-each issue
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Thu, 27 Mar 2008 17:25:32 +0530
On 3/27/08, Z W <mpc8250@xxxxxxxxx> wrote:
> 1- Because this
> <td>
> code below is getting larger
> </td>
> how do I do a call-template and passing in with this variable cib_time_duration
> and perform its task there in another template ?
> I ask cuz I like to shorten the <td> section here.

You can refactor the code in <td> into another template. For e.g., as below:

<td>
   <xsl:call-template name="generateInfo">
      <xsl:with-param name="x" select="value" />
   </xsl:call-template>
</td>

<xsl:template name="generateInfo">
   <xsl:param name="x" />

   <!--
      Generate whatever info you want here.
   -->
</xsl:template>


> 2- l have several input xml files that would fill in this <td> section.
> Is it possibe in XSLT to determine which output to display based on
> a particular xml input file. Each of these input file would be going
> through the same for-each to find its timeSpan.

This seems like a normal control flow requirement, which should be
easy to solve. If you could tell the requirement in detail, we could
possibly suggest some way to solve it.


-- 
Regards,
Mukul Gandhi

Current Thread