xslt-2.0 - 将下拉菜单的默认值设置为否
问题描述
我有一个 xslt 代码,我们从 xml 文件中获取下拉值。现在我想将下拉值默认为 NO。
下面是代码:
<td colspan="2" align="left">product:
<xsl:apply-templates select="//infor/item/" mode="dropDown">
<xsl:with-param name="xmlListFile">
<xsl:value-of select="$"/>xyz.xml
</xsl:with-param>
</xsl:apply-templates>
解决方案
根据您提供的内容,默认值可以设置为“否”,如下所示:尽管@Martin Honnen 所说的需要了解您的具体实现和内容
<xsl:variable name="dropDown_Value">
<xsl:apply-templates select="//infor/item/" mode="dropDown">
<xsl:with-param name="xmlListFile">
<xsl:value-of select="$" />xyz.xml
</xsl:with-param>
</xsl:apply-templates>
</xsl:variable>
<xsl:choose>
<xsl:when test="$dropDown_Value != ''">
<xsl:value-of select="$dropDown_Value" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'NO'" />
</xsl:otherwise>
</xsl:choose>
但是,有必要了解您的要求的详细信息。请相应地编辑您的问题。不要将代码放在注释中。
推荐阅读
- node.js - 如何使用 firebase admin sdk 删除 Firebase Storage 中的文件
- android - 自动接收 OTP 并验证 OTP,UI 未更新
- php - 我无法使用 PHP 程序更新 MySQL 数据库中的所有数据
- r - 存在 NA 时将数据从一列移动到另一列
- python - 如何计算数据框中所有等于条件的选定单词?
- reactjs - 与动态变量链接
- node.js - Filter Keys + redis + 基于条件 + node.js
- c++ - 如何使用 MSDN
- postgresql - Postgresql 和 ssl 启动错误
- c - STM32 将有符号短路写入 EEPROM