-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 回答