速度数据和 XPath
Speedata and XPath
不幸的是,我无法处理 Speedata 的 Laout.xml 中的 XPath 语法。
多年来我一直在编写 XSL,也许我有点负担过重。
我正在尝试评估的 XML 具有以下结构:
<export>
<object>
<fields>
<field key="demo1:DISPLAY_NAME" lang="de_DE" origin="default" ftype="string">Anwendungsbild</field>
<field key="demo1:DISPLAY_NAME" lang="en_UK" origin="inherit" ftype="string">application picture</field>
<field key="demo1:DISPLAY_NAME" lang="es_ES" origin="self" ftype="string">imagen de aplicación</field>
</fields>
</object>
</export>
尝试使用以下 XPath 输出元素节点失败。
export/object/fields/field[@key='demo1:DISPLAY_NAME' and @lang='de_DE' and @origin='default']
请问如何在 Speedata Publisher 中制定查询?
感谢您对我们的帮助。
speedata 软件仅支持 XPath 的一小部分。你有两个选择
- 使用提供的 Saxon XSLT 处理器预处理数据
- 自己遍历数据:
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">
<Record element="export">
<ForAll select="object/fields/field">
<Switch>
<Case test="@key='demo1:DISPLAY_NAME' and @lang='de_DE' and @origin='default'">
<SetVariable variable="whatever" select="."/>
</Case>
</Switch>
</ForAll>
<Message select="$whatever"></Message>
</Record>
</Layout>
(假设您的输入文件为 data.xml
)
不幸的是,我无法处理 Speedata 的 Laout.xml 中的 XPath 语法。 多年来我一直在编写 XSL,也许我有点负担过重。 我正在尝试评估的 XML 具有以下结构:
<export>
<object>
<fields>
<field key="demo1:DISPLAY_NAME" lang="de_DE" origin="default" ftype="string">Anwendungsbild</field>
<field key="demo1:DISPLAY_NAME" lang="en_UK" origin="inherit" ftype="string">application picture</field>
<field key="demo1:DISPLAY_NAME" lang="es_ES" origin="self" ftype="string">imagen de aplicación</field>
</fields>
</object>
</export>
尝试使用以下 XPath 输出元素节点失败。
export/object/fields/field[@key='demo1:DISPLAY_NAME' and @lang='de_DE' and @origin='default']
请问如何在 Speedata Publisher 中制定查询?
感谢您对我们的帮助。
speedata 软件仅支持 XPath 的一小部分。你有两个选择
- 使用提供的 Saxon XSLT 处理器预处理数据
- 自己遍历数据:
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">
<Record element="export">
<ForAll select="object/fields/field">
<Switch>
<Case test="@key='demo1:DISPLAY_NAME' and @lang='de_DE' and @origin='default'">
<SetVariable variable="whatever" select="."/>
</Case>
</Switch>
</ForAll>
<Message select="$whatever"></Message>
</Record>
</Layout>
(假设您的输入文件为 data.xml
)