Here's a basic example of what I'd like to do today:
IF CLASS=.TEST Show THIS content
I'm not to clear on all of the variables I can place within: < xsl:if 开发者_C百科test="{HERE}" >
*Note: I can manipulate the content by using Boolean: < xsl:if test="price>2" >
but mathematical equations won't really help me for what I'm trying to accomplish.
It looks like you need to check our w3schools here: http://www.w3schools.com/Xsl/el_if.asp.
In your scenario you might be better with
<xsl:choose>
<xsl:when test="test1">output1</xsl:when>
<xsl:when test="test2">output2</xsl:when>
...
<xsl:otherwise>some error or other</xsl:otherwise>
</xsl:choose>
In many cases you don't need to use a conditional XSLT instruction such as <xsl:if>
.
It is better to use pattern matching:
<xsl:template match="*[@class='someValue']">
<!-- Necessary processing here -->
</xsl:template>
精彩评论