我有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应如下所示。想根据Relationship 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中是否可行?