gpt4 book ai didi

xml - 有没有办法在 schematron 中传递变量?

转载 作者:数据小太阳 更新时间:2023-10-29 02:07:50 24 4
gpt4 key购买 nike

我想使用一个变量来表示我的 schematron 断言并在我的验证消息中使用它。例如:

        <rule context="//Profile/User[@name]">
<assert test="@name = ../business/@owner">User: '----' doesn't exist as a business owner. </assert>
</rule>

'----' 是用户的名称。有没有办法在 schematron 中使用变量?

最佳答案

您可以使用 value-of 来检索变量或 XPath 的值:

    <rule context="//Profile/User[@name]">
<assert test="@name = ../business/@owner">
User: <value-of select="@name"/> doesn't exist as a business owner.
</assert>
</rule>

如果你想引入一个变量,使用let:

    <rule context="//Profile/User[@name]">
<let name="userName" value="@name"/>
<assert test="@name = ../business/@owner">
User: <value-of select="$userName"/> doesn't exist as a business owner.
</assert>
</rule>

关于xml - 有没有办法在 schematron 中传递变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41948482/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com