Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在indesign中计算XPath表达式不适用于属性(xml:lang)_Xml_Applescript_Adobe Indesign - Fatal编程技术网

在indesign中计算XPath表达式不适用于属性(xml:lang)

在indesign中计算XPath表达式不适用于属性(xml:lang),xml,applescript,adobe-indesign,Xml,Applescript,Adobe Indesign,我在AdobeInDesign中使用Xpath表达式来收集元素列表。我正在使用下面的代码生成它 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 X

我在AdobeInDesign中使用Xpath表达式来收集元素列表。我正在使用下面的代码生成它

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
如果元素包含“xml:lang”属性,则上述代码无法正常工作

示例xml文件:

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

这是示例段落

您能告诉我如何使我的代码适用于上述xml编码吗。

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

当我为xml名称空间提供名称空间声明时(尽管标准中的文字是多余的),我的InDesign CS6找到了您的段落。例如

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