(続き)
<!-- アライメント -->
<xsl:template match="w:jc" as="attribute()*">
<xsl:choose>
<xsl:when test="@w:val eq 'left'">
<xsl:attribute name="text-align" select="'start'"/>
</xsl:when>
<xsl:when test="@w:val eq 'center'">
<xsl:attribute name="text-align" select="'center'"/>
</xsl:when>
<xsl:when test="@w:val eq 'right'">
<xsl:attribute name="text-align" select="'end'"/>
</xsl:when>
<xsl:when test="@w:val eq 'both'">
<xsl:attribute name="text-align" select="'justify'"/>
</xsl:when>
<xsl:when test="@w:val eq 'distribute'">
<xsl:attribute name="text-align" select="'justify'"/>
<xsl:attribute name="text-align-last" select="'justify'"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- 前景色 -->
<xsl:template match="w:color" as="attribute()">
<xsl:attribute name="color">
<xsl:text>#</xsl:text><xsl:value-of select="@w:val"/>
</xsl:attribute>
</xsl:template>
<!-- フォントサイズ -->
<xsl:template match="w:sz" as="attribute()">
<xsl:attribute name="font-size">
<xsl:value-of select="concat(string(@w:val div 2),'pt')"/>
</xsl:attribute>
</xsl:template>
<!-- フォントファミリー -->
<xsl:template match="wx:font" as="attribute()">
<xsl:attribute name="font-family">
<xsl:value-of select="@wx:val"/>
</xsl:attribute>
</xsl:template>
<!-- ボールド -->
<xsl:template match="w:b" as="attribute()">
<xsl:attribute name="font-weight" select="if (not(@w:val) or @w:val='on') then 'bold' else 'normal'"/>
</xsl:template>
<!-- イタリック -->
<xsl:template match="w:i" as="attribute()">
<xsl:attribute name="font-style" select="if (not(@w:val) or @w:val='on') then 'italic' else 'normal'"/>
</xsl:template>
</xsl:stylesheet>
<xsl:template match="w:jc" as="attribute()*">
<xsl:choose>
<xsl:when test="@w:val eq 'left'">
<xsl:attribute name="text-align" select="'start'"/>
</xsl:when>
<xsl:when test="@w:val eq 'center'">
<xsl:attribute name="text-align" select="'center'"/>
</xsl:when>
<xsl:when test="@w:val eq 'right'">
<xsl:attribute name="text-align" select="'end'"/>
</xsl:when>
<xsl:when test="@w:val eq 'both'">
<xsl:attribute name="text-align" select="'justify'"/>
</xsl:when>
<xsl:when test="@w:val eq 'distribute'">
<xsl:attribute name="text-align" select="'justify'"/>
<xsl:attribute name="text-align-last" select="'justify'"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- 前景色 -->
<xsl:template match="w:color" as="attribute()">
<xsl:attribute name="color">
<xsl:text>#</xsl:text><xsl:value-of select="@w:val"/>
</xsl:attribute>
</xsl:template>
<!-- フォントサイズ -->
<xsl:template match="w:sz" as="attribute()">
<xsl:attribute name="font-size">
<xsl:value-of select="concat(string(@w:val div 2),'pt')"/>
</xsl:attribute>
</xsl:template>
<!-- フォントファミリー -->
<xsl:template match="wx:font" as="attribute()">
<xsl:attribute name="font-family">
<xsl:value-of select="@wx:val"/>
</xsl:attribute>
</xsl:template>
<!-- ボールド -->
<xsl:template match="w:b" as="attribute()">
<xsl:attribute name="font-weight" select="if (not(@w:val) or @w:val='on') then 'bold' else 'normal'"/>
</xsl:template>
<!-- イタリック -->
<xsl:template match="w:i" as="attribute()">
<xsl:attribute name="font-style" select="if (not(@w:val) or @w:val='on') then 'italic' else 'normal'"/>
</xsl:template>
</xsl:stylesheet>
結果は次のようになります.余分なスペースは除いてあります.(これだけでは完全なXSL-FOではありませんの
でご了解ください.)
<?xml version="1.0" encoding="UTF-8"?>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" text-align="start">
<fo:inline font-family="Century" color="#0000FF" font-size="10.5pt" font-weight="bold">Bold</fo:inline>
<fo:inline font-family="Century" color="#0000FF" font-size="10.5pt">&</fo:inline>
<fo:inline font-family="Century" color="#0000FF" font-size="10.5pt" font-style="italic">italic</fo:inline>
</fo:block>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" text-align="start">
<fo:inline font-family="Century" color="#0000FF" font-size="10.5pt" font-weight="bold">Bold</fo:inline>
<fo:inline font-family="Century" color="#0000FF" font-size="10.5pt">&</fo:inline>
<fo:inline font-family="Century" color="#0000FF" font-size="10.5pt" font-style="italic">italic</fo:inline>
</fo:block>
いかがでしょうか?テーブル・段落スタイルで定義されたスタイル情報がattribute()*のsequenceをパラメータとして下位に伝えられる様子がわかっていただければと思います.