-1

以下のような XML ファイル doc.xml があります。

<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
    <w:p w:rsidR="002576E5" w:rsidRDefault="006D0E45">
        <w:pPr>
            <w:pStyle w:val="figure"/>
        </w:pPr>
    <w:r><w:t xml:space="preserve">Figure 1 </w:t></w:r>
    </w:p>
    <w:p w:rsidR="002576E5" w:rsidRDefault="006D0E45">
        <w:pPr>
            <w:pStyle w:val="figure"/>
        </w:pPr>
    <w:r><w:t xml:space="preserve">Figure 2</w:t></w:r>
    </w:p>
</w:document>

同じ場所に別のファイル doc.xml.res があります

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
    <Relationship Id="rId8" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships /oleObject" Target="embeddings/oleObject1.bin"/>
    </Relationship>
</Relationships>

XSLT を使用して各 w:p[w:pPr/w:pStyle/@w:val="figure"] を見つけた場合、doc.xml.rels ファイルを次のように変更します。

<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
    <Relationship Id="rId8" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject" Target="embeddings/oleObject1.bin"/>
    </Relationship>
    <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject" Target="c://1.jpg"/>
    </Relationship>
    <Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject" Target="c://2.jpg"/>
    </Relationship>
</Relationships>

doc.xml は次のようになります。リレーションシップ ID に従って imagedate r:id を持つ pict 要素を追加したい:

<w:p>
    <w:r>
        <w:pict>
            <v:shape id="myShape2" type="#_x0000_t75" style="width:400; height:240">
                <v:imagedata r:id="rId3"/>
            </v:shape>
        </w:pict>
    </w:r>
</w:p>
<w:p w:rsidR="002576E5" w:rsidRDefault="006D0E45">
    <w:pPr>
        <w:pStyle w:val="figure"/>
    </w:pPr>
    <w:r><w:t xml:space="preserve">Figure 1 </w:t></w:r>
</w:p>
<w:p>
    <w:r>
        <w:pict>
            <v:shape id="myShape2" type="#_x0000_t75" style="width:400; height:240">
                <v:imagedata r:id="rId4"/>
        </v:shape>
        </w:pict>
    </w:r>
</w:p>
<w:p w:rsidR="002576E5" w:rsidRDefault="006D0E45">
    <w:pPr>
        <w:pStyle w:val="figure"/>
    </w:pPr>
    <w:r><w:t xml:space="preserve">Figure 2</w:t></w:r>
</w:p>

これは XSLT で可能ですか?

4

1 に答える 1

0

はい、これは可能なはずです。result-documentを使用すると、他のファイルを書き込むことができます。それらを読み取るには、document(uri)関数を使用できます。

于 2012-08-07T10:42:27.147 に答える