在最后一项之前带有'and'的 XSLT 分隔符



我在这里有一个问题,即我必须显示以逗号分隔的coursename Awards的求职信。没关系,我可以使用与A分隔符的for-each代码来做到这一点。问题是我想在最后一个奖项之前插入和'和'字符串。而且我无济于事。任何帮助将不胜感激。

  I wish to apply for the above post. i have


这是XML代码


<!-- educational history starts below-->
<school>    
    <education>     
        <fromYear> 2010 </fromYear>
        <toYear> 2014 </toYear>
        <courseName> Bachelor of Science in Physocology </courseName>
        <institution> The University of Dublin, Trinity College </institution>
    </education>
    <education>
        <fromYear> 2004 </fromYear>
        <toYear> 2010 </toYear>
        <institution> Cadbury College, Ballyknock, CoRoscommon </institution>
            <subject>English (A1),Irish (B2) , History (B2),French (B3)and Maths (B1)</subject>
    </education>
    <education>
        <institution> University of Dublin, Trinity College </institution>
        <courseName>Bachelor of Arts in Economics, June 2005 </courseName>
        <subjects> Firms and Development, Statistics, Applied Economics and International Economics </subjects>
    </education>
</school>

so:

  • 位置= 1之前,什么都没有插入

  • 位置= 2..last()-1,插入","

  • 位置= last(),插入"one_answers"

那是

<xsl:for-each select=".....">
  <xsl:choose>
   <xsl:when test="position()=1"/>
   <xsl:when test="position()=last()">, and </xsl:when>
   <xsl:otherwise>, </xsl:otherwise>
  </xsl:choose>
  <xsl:value-of select="."/>
</xsl:for-each>

相关内容

  • 没有找到相关文章

最新更新