sequenceの使い方ですが、今までの例は静的な使い方でした.前回sequenceに関する関数を一通り紹介したので、テンプレートのパラメータとして動的に使う方法を試してみたいと思います.
入力ファイルは、Word2003で搭載されたWordMLというXML形式です.それを超簡単にしたものです.余計な要素・属性をすべて取り払っていますが、それでもWordで読み込むとちゃんと文書として認識してくれます.(Word2003で確認しています.)スタイルで定義された段落属性、インライン属性を継承させることを見ていただきたいため、テーブルのセルに"Bold&italic"という段落を入れています.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint">
<w:styles>
<w:style w:type="paragraph" w:default="on" w:styleId="Normal">
<w:name w:val="Normal"/>
<w:pPr>
<w:widowControl w:val="off"/>
<w:jc w:val="left"/>
</w:pPr>
<w:rPr>
<w:color w:val="0000FF"/>
<w:sz w:val="21"/>
</w:rPr>
</w:style>
<w:style w:type="table" w:default="on" w:styleId="TableNormal">
<w:name w:val="Normal Table"/>
<w:rPr>
<w:rFonts w:ascii="Century" w:fareast="Century" w:h-ansi="Century"/>
<wx:font wx:val="Century"/>
</w:rPr>
<w:tblPr>
<w:tblInd w:w="0" w:type="dxa"/>
<w:tblCellMar>
<w:top w:w="0" w:type="dxa"/>
<w:left w:w="108" w:type="dxa"/>
<w:bottom w:w="0" w:type="dxa"/>
<w:right w:w="108" w:type="dxa"/>
</w:tblCellMar>
</w:tblPr>
</w:style>
</w:styles>
<w:body>
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="TableNormal"/>
<w:tblW w:w="0" w:type="auto"/>
<w:tblLook w:val="01E0"/>
</w:tblPr>
<w:tblGrid>
<w:gridCol w:w="1800"/>
</w:tblGrid>
<w:tr>
<w:tc>
<w:tcPr>
<w:tcW w:w="1800" w:type="dxa"/>
</w:tcPr>
<w:p>
<w:pPr>
</w:pPr>
<w:r>
<w:rPr>
<w:b/>
</w:rPr>
<w:t>Bold</w:t>
</w:r>
<w:r>
<w:t>&</w:t>
</w:r>
<w:r>
<w:rPr>
<w:i/>
</w:rPr>
<w:t>italic</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
</w:tbl>
</w:body>
</w:wordDocument>
<?mso-application progid="Word.Document"?>
<w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint">
<w:styles>
<w:style w:type="paragraph" w:default="on" w:styleId="Normal">
<w:name w:val="Normal"/>
<w:pPr>
<w:widowControl w:val="off"/>
<w:jc w:val="left"/>
</w:pPr>
<w:rPr>
<w:color w:val="0000FF"/>
<w:sz w:val="21"/>
</w:rPr>
</w:style>
<w:style w:type="table" w:default="on" w:styleId="TableNormal">
<w:name w:val="Normal Table"/>
<w:rPr>
<w:rFonts w:ascii="Century" w:fareast="Century" w:h-ansi="Century"/>
<wx:font wx:val="Century"/>
</w:rPr>
<w:tblPr>
<w:tblInd w:w="0" w:type="dxa"/>
<w:tblCellMar>
<w:top w:w="0" w:type="dxa"/>
<w:left w:w="108" w:type="dxa"/>
<w:bottom w:w="0" w:type="dxa"/>
<w:right w:w="108" w:type="dxa"/>
</w:tblCellMar>
</w:tblPr>
</w:style>
</w:styles>
<w:body>
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="TableNormal"/>
<w:tblW w:w="0" w:type="auto"/>
<w:tblLook w:val="01E0"/>
</w:tblPr>
<w:tblGrid>
<w:gridCol w:w="1800"/>
</w:tblGrid>
<w:tr>
<w:tc>
<w:tcPr>
<w:tcW w:w="1800" w:type="dxa"/>
</w:tcPr>
<w:p>
<w:pPr>
</w:pPr>
<w:r>
<w:rPr>
<w:b/>
</w:rPr>
<w:t>Bold</w:t>
</w:r>
<w:r>
<w:t>&</w:t>
</w:r>
<w:r>
<w:rPr>
<w:i/>
</w:rPr>
<w:t>italic</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
</w:tbl>
</w:body>
</w:wordDocument>
これをXSL-FOに変換してみたいと思います.表のセルから段落のみ抽出します.主な機能は次のようなWordML→XSL-FOの変換です
w:p(段落)→fo:block
w:r(インライン)→fo:inline
w:r(インライン)→fo:inline
(続く)