xslt - XSLT xsl:选择探针
问题描述
我的 xml 行之一如下所示:
<cf_task_subscription amount="1200.0" code="GBP">£1,200.00</cf_task_subscription>
我想设置一个 xls:choose 规则,如下所示,但我不能这样做,因为 XML 添加了 £ 符号:
<xsl:variable name="value" select="/hash/cf_task_subscription"/>
<xsl:choose>
<xsl:when test="$value > 1200.0">John Doe</xsl:when>
<xsl:when test="$value = 1200.0">Jane Doe</xsl:when>
<xsl:otherwise>Unassigned</xsl:otherwise>
</xsl:choose>
所以我的问题是,有没有办法告诉 xsl 只考虑 cf_task_subscription 标记的 amount="1200.00" 部分?
谢谢,
解决方案
由于信息已在属性中以结构化形式精心提供,与文本节点中的“显示形式”分开,那么利用它:
<xsl:when test="$value/@amount > 1200.0">John Doe</xsl:when>
推荐阅读
- python - 将列表中的随机元素添加到现有数据帧字符串
- angular - 表情符号没有出现在 git cz 的提交中
- flutter - 打开键盘时如何移动AppBar?
- c# - 打印从 5 到 N 的素数的 C# 代码
- matplotlib - 将图保存为 .eps 时,灰色 matpotlib 图面颜色变为黑色
- c# - Xamarin Android 布局将图像右对齐
- c++ - CMake:基于 Clang 的 Linux 交叉编译使用错误的目标平台
- python - 使用 matplotlib 和 geopandas 在地图上用不同的投影注释标签时遇到问题
- pytorch - Pytorch 用户对旧 GPU 的警告
- html - How to set color from API response in border-color in Angular?