Thread: re write a code
View Single Post
  #1 (permalink)  
Old August 1st, 2007, 03:35 AM
kgoldvas kgoldvas is offline
Authorized User
 
Join Date: Jan 2006
Location: tel aviv, israel, Israel.
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default re write a code

hello

in my code I have alot of template calls that look the same, but with different parameters.
is there a way to re-write it, so the code will look nicer and readable?
for example - calling the same templates with same parameters but different values.

<xsl:call-template name="common-time-display">
    <xsl:with-param name="v2" select="'total-time-display'"/>
    <xsl:with-param name="display" select="/etd/counters/counter/display/@sum-format"/>
    <xsl:with-param name="baseline_column_key" select="'TT_BL'"/>
    <xsl:with-param name="baseline_column_display" select="'!~stationTech!~-TT_BL'"/>
    <xsl:with-param name="tooltip_column_key" select="'TT'"/>
    <xsl:with-param name="tooltip_column_display" select="'!~stationTech!~-TT'"/>
    <xsl:with-param name="tooltip_baseline_template_key" select="concat(@dbcolumn, '_BL')"/>
    <xsl:with-param name="tooltip_baseline_template_display" select="concat('!~stationTech!~-', @dbcolumn, '_BL')"/>
    <xsl:with-param name="flag" select="'total'"/>
</xsl:call-template>
<xsl:call-template name="common-time-display">
    <xsl:with-param name="v2" select="'average-time-display'"/>
    <xsl:with-param name="display" select="/etd/counters/counter/display/@avg-format"/>
    <xsl:with-param name="baseline_column_key" select="'AVG_TT_BL'"/>
    <xsl:with-param name="baseline_column_display" select="'!~stationTech!~-AVG_TT_BL'"/>
    <xsl:with-param name="tooltip_column_key" select="'AVG_TT'"/>
    <xsl:with-param name="tooltip_column_display" select="'!~stationTech!~-AVG_TT'"/>
        <xsl:with-param name="tooltip_baseline_template_key" select="concat('AVG_', @dbcolumn, '_BL')"/>
    <xsl:with-param name="tooltip_baseline_template_display" select="concat('!~stationTech!~-', 'AVG_', @dbcolumn, '_BL')"/>
    <xsl:with-param name="flag" select="'avg'"/>
</xsl:call-template>

hope that I was clear enough.
Thanks
Kfir