1
<xsl:template match="o:CustomDocumentProperties">
        <xsl:copy>
            <xsl:apply-templates select ="@*|node()" />
        </xsl:copy>
</xsl:template>

Word 2003では、上記のxsl:template matchステートメントを使用して、Wordのドキュメント2003のカスタムプロパティを取得できます。

Office Word 2007または2010で作業している場合に使用する構文は何ですか?

4

1 に答える 1

0

カスタムドキュメントプロパティは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>

次のように、スタイルシートでプレフィックス「prop」を使用して名前空間を宣言するとします。

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>
于 2012-01-16T02:12:21.463 に答える