概要
条件によって値の違う式を表示
利用方法
<branch size="条件の数"> <case><equ>式1</equ><cond>条件1</cond></case> <case><equ>式2</equ><cond>条件2</cond></case> . . . <case><equ>式n</equ><cond>条件n</cond></case> </branch>
サンプル
<abs>x</abs>= <branch size="2"> <case><equ>x</equ><cond><math>x≧0</math></cond></case> <case><equ>−x</equ><cond><math>x<0</math></cond></case> </branch>
|x|=
{
x | (x≧0) |
−x | (x<0) |
XSL template
<xsl:template match="ufcpp:branch"> <span class="paren"> <xsl:attribute name="style">font-size:<xsl:value-of select="@size"/>em;</xsl:attribute> { </span> <table class="branch" summary="conditional"> <xsl:for-each select="ufcpp:case"> <tr> <td><span class="math"><xsl:apply-templates select="ufcpp:equ"/></span>  </td> <td> <span class="paren">(</span> <span class="math"><xsl:apply-templates select="ufcpp:cond"/></span> <span class="paren">)</span> </td> </tr> </xsl:for-each> </table> </xsl:template> <xsl:template match="ufcpp:branch/ufcpp:case/ufcpp:equ"> <xsl:apply-templates/> </xsl:template> <xsl:template match="ufcpp:branch/ufcpp:case/ufcpp:cond"> <xsl:apply-templates/> </xsl:template>
style sheet
table.branch { display:inline; font-style:italic; vertical-align:bottom; vertical-align:middle; } span.paren { font-style:normal; vertical-align:middle; } span.normal { font-weight:normal; font-style:normal; }