Amar,

 Seems to me that you'd need to duplicate some of your code in order for everything to be resolved statically. You can do this by either duplicating templates or using xsl:if or a similar construct. I see from your example that you're calling your template in two places, are all the parameters for all the invocations to mySelectFieldNew known statically? 

-- Santiago

On Feb 24, 2006, at 5:27 PM, Reddy Anapalli Amarendra-E65017C wrote:

Hi,
 
I am new to xsl development , however I am determined to work on xsl porting project from Xalan interpretive to xalan compiled processor.
 
cut short version template is given below. app.xsl references generic.xsl and makes a template call with parameters. because I am trying to learn too many
things at a time , I am finding difficulty in replacing xalan:evalaute() function with standard XPath predicates.
 
Please help me with some clues on replacing xalan:evalaute with standard XPath expressions. Also some guidance to gain sufficient knowledge to replace such a calls made in several other places in
the entire project.
 
I am using xsltc for converting these static xsl files into translet for performance reasons. So there was a need for replacement of evaluate calls
 
Thanks & Regards,
Amar
app.xsl
 
<xsl:call-template name="mySelectFieldNew">
         <xsl:with-param name="OptionPath">/WMS/wms_ref_annc_id/Row</xsl:with-param>
         <xsl:with-param name="Value">value</xsl:with-param>
         <xsl:with-param name="Display">display</xsl:with-param>
</xsl:call-template>
 
<xsl:call-template name="mySelectFieldNew">
         <xsl:with-param name="OptionPath">/WMS/wms_ref_pref_lang/Row</xsl:with-param>
        <xsl:with-param name="Value">value</xsl:with-param>
        <xsl:with-param name="Display">display</xsl:with-param>
</xsl:call-template>
 
generic.xsl:
 
<xsl:template name="mySelectFieldNew">
    <xsl:param name="OptionPath" select="$default"/>
    <xsl:param name="Value" select="$default-value"/>
    <xsl:param name="Display" select="$default-display"/>
    <xsl:param name="Sort"     select="'off'"/>
    <xsl:param name="SelectedValuePath" select="$default"/>
     <xsl:param name="ConstantSelectedValuePath" select="$default"/>
 
    <xsl:choose>
        <xsl:when test="not($OptionPath=$default)">
                <xsl:choose>
                  <xsl:when test="$Sort = 'on'"> <!-- sorted -->
                    <xsl:for-each select="xalan:evaluate($OptionPath)">
                      <xsl:sort select="xalan:evaluate($Display)"/>
                      <option>
                        <xsl:if test="not($SelectedValuePath=$default and $ConstantSelectedValuePath=$default)">
                              <xsl:if test="$selectVal = xalan:evaluate($Value)">
                                <xsl:attribute name="selected"/>
                              </xsl:if>
                        </xsl:if>
 
                        <xsl:attribute name="value">
                        <xsl:value-of select="xalan:evaluate($Value)"/>
                        </xsl:attribute>
                        <xsl:value-of select="xalan:evaluate($Display)"/>
                      </option>
                    </xsl:for-each>
             </xsl:when>
             <xsl:otherwise> <!-- unsorted -->
                    <xsl:for-each select="xalan:evaluate($OptionPath)">
                      <option>
                        <xsl:if test="not($SelectedValuePath=$default and $ConstantSelectedValuePath=$default)">
                              <xsl:if test="$selectVal = xalan:evaluate($Value)">
                                <xsl:attribute name="selected"/>
                              </xsl:if>
                        </xsl:if>
 
                        <xsl:attribute name="value">
                        <xsl:value-of select="xalan:evaluate($Value)"/>
                        </xsl:attribute>
                        <xsl:value-of select="xalan:evaluate($Display)"/>
                      </option>
                    </xsl:for-each>
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:when>
              <xsl:otherwise>
 
<xsl:template>

Reply via email to