2013-08-03 2 views
1

내 XSLT에서/또는/및 두 열과 일치하는이 함수가 있습니다. FieldRef은 완벽하게 일치합니다.XSLT에서 두 필드 일치 및 현재 값 얻기

내 문제는 $currentValue은 내가 테스트하고있는 것 (필자는 빈 문자열 인 것 같습니다)과 동등하지 않은 것 같습니다.

여기서 제가 잘못 되었나요? 내가 알고

<!-- Convert the Fields into a status icons --> 
<xsl:template match="FieldRef[@Name='YesNo']|FieldRef[@Name='TrueFalse']" mode="body"> 
    <xsl:param name="thisNode" select="." /> 
    <xsl:variable name="currentValue" select="$thisNode/@*[name()=current()/@Name]" /> 

    <xsl:choose> 
     <xsl:when test="$currentValue='Yes'"> 
      <span class="yesno yes"><xsl:value-of select="$currentValue" /></span> 
     </xsl:when> 
     <xsl:when test="$currentValue='No'"> 
      <span class="yesno no"><xsl:value-of select="$currentValue" /></span> 
     </xsl:when> 
     <xsl:when test="$currentValue='True'"> 
      <span class="yesno yes"><xsl:value-of select="$currentValue" /></span> 
     </xsl:when> 
     <xsl:when test="$currentValue='False'"> 
      <span class="yesno no"><xsl:value-of select="$currentValue" /></span> 
     </xsl:when>  
     <xsl:otherwise> 
      <span class="yesnoN"><xsl:value-of select="$currentValue" /></span> 
     </xsl:otherwise> 
    </xsl:choose> 

</xsl:template> 

한 가지 내가

<xsl:variable name="thisName" select="./@Name" /> select="./@Name" /> 

을한다면 그때는 분야 자체 (대신 값)의 이름을 사용하여 일치하도록 시도 할 것입니다.

어떻게해야합니까?

답변

0

아, 수 시간 후, 여기있다 :

이들 두 줄

열쇠이다 : 여기
<xsl:param name="thisNode" select="."/> 
<xsl:variable name="currentValue" select="$thisNode/@*[name()=current()/@Name]" /> 

두 가지 항목을 판독하고 값이 적용되는 전체 기능이다 어느 하나

<xsl:template match="FieldRef[@Name='YesNo1']|FieldRef[@Name='YesNo2']" mode="body"> 
    <xsl:param name="thisNode" select="."/> 

    <xsl:variable name="currentValue" select="$thisNode/@*[name()=current()/@Name]" /> 
    <xsl:variable name="yesvalue">Yes</xsl:variable> 
    <xsl:variable name="novalue">No</xsl:variable> 

    <xsl:choose> 
     <xsl:when test="contains($currentValue, $yesvalue)"> 
      <span class="yesno yes"><xsl:value-of select="$currentValue" /></span> 
     </xsl:when> 
     <xsl:when test="contains($currentValue, $novalue)"> 
      <span class="yesno no"><xsl:value-of select="$currentValue" /></span> 
     </xsl:when> 
    <xsl:otherwise> 
      <span class="yesnoN"><xsl:value-of select="$currentValue" /></span> 
     </xsl:otherwise> 
    </xsl:choose> 

</xsl:template> 

some other examples of matching on multiple match fields here을있다.