自定义文档属性一个Properties
元素下保持并使用以下命名空间:
http://schemas.openxmlformats.org/officeDocument/2006/extended-properties
的电话号码的自定义属性的例子:
<pkg:part pkg:name="/docProps/custom.xml"
pkg:contentType="application/vnd.openxmlformats-officedocument.custom-properties+xml"
pkg:padding="256">
<pkg:xmlData>
<Properties
xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
<property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="3"
name="Telephone number">
<vt:lpwstr>555-555-5555</vt:lpwstr>
</property>
</Properties>
</pkg:xmlData>
</pkg:part>
假设你申报与命名空间前缀“托”在样式表是这样的:
xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
,如果你保存为一个XML文件,你可以用下面的XPath找到它们:
pkg:package/pkg:part/pkg:xmlData/prop:Properties
,你可以创建一个模板匹配这样的:
<xsl:template match="prop:Properties">
<xsl:copy>
<xsl:apply-templates select ="@*|node()" />
</xsl:copy>
</xsl:template>
我认为这个问题是等同于“什么是用于Word 2007或2010中文档自定义属性的XML元素?”,因此它不是一个xslt或xpath问题,而是一个关于XML词汇表的OOXML(WordML)问题。在http://www.ecma-international.org/publications/standards/Ecma-376.htm查看第3版第1部分我在WordML中看不到任何关于自定义属性的内容。但我在这方面没有经验。 – LarsH