2011-12-13 98 views
0

我有这样一段代码:XSLT变量看重

 <xsl:variable name="varPriceDate"> 
      <xsl:call-template name="lookup_MarketGNLPricesFile_Valor"> 
      <xsl:with-param name="PARAM_Key" select="'A'"/> 
      </xsl:call-template> 
     </xsl:variable> 
     <xsl:element name="priceDate"> 
      <xsl:value-of select="Col[$varPriceDate]"/> 
     </xsl:element> 
     <xsl:variable name="varPrice"> 
      <xsl:call-template name="lookup_MarketGNLPricesFile_Valor"> 
      <xsl:with-param name="PARAM_Key" select="'B'"/> 
      </xsl:call-template> 
     </xsl:variable> 
     <xsl:element name="price"> 
      <xsl:value-of select="Col[$varPrice]"/> 
     </xsl:element> 

<xsl:value-of select="Col[$varPriceDate]"/>是显示相同的结果<xsl:value-of select="Col[$varPrice]"/>。 你能帮我吗?我需要溶液它

+0

向我们展示一些上下文,我们确实需要查看被调用的那些模板的返回类型和值。您可能要像'上校[位置()= $ VAR]'而不是你有什么,但是这是一个猜测,向我们展示了必要的详细资料,我们无需猜测可以提供帮助。 –

回答

1

两个变量的值是结果树片段(在XSLT 2.0,文档节点),以及结果树片段的有效布尔值始终为true。因此,表达式Col[$varPriceDate]Col[$varPrice]都等同于简单地写Col

为了纠正这个问题,我们需要知道代码的目的是达到什么目的,这是不明确的。