# XSLT 特定意图操作

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/zh-cn/help/go/llms.txt).

XSLT 支持提供了一些对 XSLT 开发有用的意图。

## 在开始之前

按照 [从 JetBrains Marketplace 安装插件](managing-plugins.html#install_plugin_from_repo) 中的描述，在   设置 | 插件   页面上安装并启用  XPathView + XSLT  插件。

## 将 xsl:if 转换为 xsl:choose 的意图

如果发现简单的 if 分支在某些情况下不够用并且需要 else 分支时，这会很有用。 将插入符号放在  `xsl:if`  的起始标签时，意图会显示并将代码片段转换为  `xsl:choose` ，同时保留原始的  `xsl:if`  作为  `xsl:when`  块，并添加一个  `xsl:otherwise`  块。

|  之前  |  之后  |
| --- | --- |
|    ![将 xsl:if 转换为 xsl:choose](https://resources.jetbrains.com/help/img/idea/2026.3/convert-if-to-choose.png)  |    ![将 xsl:if 转换为 xsl:choose 的结果](https://resources.jetbrains.com/help/img/idea/2026.3/convert-if-to-choose-after.png)  |

## 添加可选参数的意图

此意图可用于在模板调用中为可选参数传递值。 它将插入适当的  `xsl:with-param`  标签，并显示一个查找列表，列出所有尚未传递给模板的参数。

|  之前  |  之后  |
| --- | --- |
|    ![添加可选参数](https://resources.jetbrains.com/help/img/idea/2026.3/add-optional-arguments.png)  |    ![添加可选参数](https://resources.jetbrains.com/help/img/idea/2026.3/add-optional-arguments-result.png)  |

