在我的Sharepoint fldtypes_custom.xsl
文件中,我有這個代碼,它完美的工作。但是,我想在三個或四個相似的字段上使用相同的代碼。如何匹配xsl模板中的這個OR?
有沒有一種方法可以在同一個模板中匹配status1
或status2
或OR status3
字段?現在我必須有這個代碼塊的三個副本,其中唯一的區別是fieldref
名稱。我想安裝代碼。
<xsl:template match="FieldRef[@Name='status1']" mode="body">
<xsl:param name="thisNode" select="."/>
<xsl:variable name="currentValue" select="$thisNode/@status1" />
<xsl:variable name="statusRating1">(1)</xsl:variable>
<xsl:variable name="statusRating2">(2)</xsl:variable>
<xsl:variable name="statusRating3">(3)</xsl:variable>
<xsl:choose>
<xsl:when test="contains($currentValue, $statusRating1)">
<span class="statusRatingX statusRating1"></span>
</xsl:when>
<xsl:when test="contains($currentValue, $statusRating2)">
<span class="statusRatingX statusRating2"></span>
</xsl:when>
<xsl:when test="contains($currentValue, $statusRating3)">
<span class="statusRatingX statusRating3"></span>
</xsl:when>
<xsl:otherwise>
<span class="statusRatingN"></span>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
類似到http://stackoverflow.com/q/616427/2047725 – w5m
只想鏈接兩個爲未來讀者的利益 – w5m
啊,臨屋區那麼。我衷心贊同鏈接問題。 – bgmCoder