OR 条件语句的 XSLT 较短版本 [英] XSLT shorter version of OR conditional statement

查看:24
本文介绍了OR 条件语句的 XSLT 较短版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人记得如何在 XSLT 中编写更短的 OR 语句.我确定有办法,但我不记得了.

I was wondering if someone remembers how to write a shorter OR statements in XSLT. I'm sure there was a way but I can't remember.

所以代替

test="$var = 'text1' or $var = 'text2'"

我想使用较短的版本,例如 test="$var =['text1','text2']" 但是,我不记得或找不到适用于此类情况的正确速记语法.

I'd like to use a shorter version like test="$var =['text1','text2']" However, I can't remember or find the right shorthand syntax for such cases.

如果有人能提供帮助,我们将不胜感激!

Would really appreciate if someone could help with that!

非常感谢

推荐答案

您可以使用 XSLT 2.0(但不适用于 XSLT 1.0)

With XSLT 2.0 (but not with XSLT 1.0) you can do

<xsl:if test="$var = ('text1','text2')">

也许这就是您正在寻找的语法.

Maybe that is the syntax you are looking for.

这篇关于OR 条件语句的 XSLT 较短版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆