xslt - 测试包含在 XSLT 1.0 中使用不区分大小写的匹配
问题描述
如果值存在于我发送的 appName 中,我有以下匹配条件,它用于获取结果:
<xsl:if test="contains($appName , $value)">
<xsl:call-template name="formResponseBody">
</xsl:call-template>
</xsl:if>
但是,现在我必须进行完全相同的测试,但忽略“$value”中数据的情况。
我试过使用翻译函数,但它们要么转换为大写,要么转换为小写,但我的测试用例是数据是一个值,可以是“TEST”、“test”、“TestT”。
<xsl:variable name="lowercase">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="uppercase">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
<xsl:variable name="value1" select="translate($value, $uppercase, $lowercase)">
这在 XSLT 1.0 中可行吗?
解决方案
$appName
将and规范化$value
为大写或小写,然后测试 normalized 是否$appName
包含 normalized $value
:
<xsl:if test="contains(
translate($appName, $uppercase, $lowercase) ,
translate($value, $uppercase, $lowercase))">
推荐阅读
- php - 如何在 PhpStorm 中调试客户端请求
- r - 使用 RSelenium 对元素执行右键单击
- ansible - Ansible中'secret'关键字的含义是什么
- c - 内存分配和泄漏问题?
- oracle - FOR variable_name IN (values)怎么办?(使用枚举值而不是范围)
- networking - Kubectl:通过企业 SSL 感知代理访问 AKS (Kubernetes) 公共 API 端点
- android-studio - Android Studio如何在颤动中删除构建方法中的行
- matlab - 有没有办法绘制一个带有方程(来自 ODE 系统)的函数 f?
- r - R:使用 MatchIt 进行倾向得分匹配。如何使用replace = TRUE找到匹配观察的数量?
- java - 使用 ExecutorService 在具有通过循环传递的不同参数的类中同时执行方法的问题