目次

概要

テーブル状の行列を表示

利用方法

<matrix size="行列の高さ">
  <row><elem>1,1成分</elem>...<elem>1,n成分</elem>
  .
  .
  .
  <row><elem>m,1成分</elem>...<elem>m,n成分</elem>
</matrix>

サンプル

<vervec size="3"><elem>x'</elem><elem>y'</elem><elem>z'</elem></vervec> = 
<matrix size="3">
<row><elem>a</elem><elem>b</elem><elem>c</elem></row>
<row><elem>d</elem><elem>e</elem><elem>f</elem></row>
<row><elem>g</elem><elem>h</elem><elem>i</elem></row>
</matrix>
<vervec size="3"><elem>x</elem><elem>y</elem><elem>z</elem></vervec>
[
x'
y'
z'
] = [
abc
def
ghi
] [
x
y
z
]

XSL template

<xsl:template match="ufcpp:matrix">
  <span class="paren">
    <xsl:attribute name="style">font-size:<xsl:value-of select="@size"/>em;</xsl:attribute>
    [
  </span>
  <table class="matrix" summary="matrix">
    <xsl:apply-templates select="ufcpp:row"/>
  </table>
  <span class="paren">
    <xsl:attribute name="style">font-size:<xsl:value-of select="@size" />em;</xsl:attribute>
    ]
  </span>
</xsl:template>

<xsl:template match="ufcpp:array">
  <table class="matrix" summary="array">
    <xsl:apply-templates select="ufcpp:row"/>
  </table>
</xsl:template>

<xsl:template match="ufcpp:matrix/ufcpp:row|ufcpp:array/ufcpp:row">
  <tr><xsl:apply-templates select="ufcpp:elem"/></tr>
</xsl:template>

<xsl:template match="ufcpp:matrix/ufcpp:row/ufcpp:elem|ufcpp:array/ufcpp:row/ufcpp:elem">
  <td><xsl:apply-templates/></td>
</xsl:template>

style sheet

table.matrix
{
  display:inline;
  font-style:italic;
  text-align:center;
  vertical-align:bottom;
  vertical-align:middle;
}

span.paren
{
  font-style:normal;
  vertical-align:middle;
}

更新履歴

ブログ