0

I am using Xpath expression in Adobe Indesign, to collect the list of elements. I am using the below code to generate it.

tell application "Adobe InDesign CS5.5"
    set user interaction level of script preferences to never interact
    tell active document
        tell XML element 1
            set myElement to evaluate XPath expression using "//para"
        end tell
    end tell
    set user interaction level of script preferences to interact with all
end tell

The above code does not works fine if the element contains "xml:lang" attribute.

Sample xml file:

<chapter>
<section>
<para xml:lang="en">This is sample para</para>
</section>
</chapter>

could you please let me know how i need to make my code to work for the above xml coding.

4

1 回答 1

2

InDesign 在命名空间方面存在几个问题。当您使用ExtendScript 的“XML”对象或根本不使用它们时(例如,在导入时通过XSLT 去除/替换它们),它们会更好地工作。

当我为 xml 命名空间提供命名空间声明时(即使按照标准的话来说是多余的),我的 InDesign CS6 找到了你的 para. 例如

tell application "Adobe InDesign CS6"
    tell XML element 1 of active document
        make XML attribute with properties {name:"xmlns:xml", value:"http://www.w3.org/XML/1998/namespace"}
    evaluate XPath expression using "//para"
    end tell
end tell
于 2013-07-26T18:25:40.587 回答