xslt - 添加 XSL:Stylesheet If Then Else
问题描述
我正在尝试对我在 CCure(访问控制系统)中为 LDAP 编写的查询使用选择、何时和否则语句。TEXT18 值应为“非活动”。Text12 值应为“False”。否则,从 LDAP 属性中提取数据并创建另一个列名“禁用”。希望这是有道理的,谢谢。
<?xml version ="1.0" encoding="utf8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<!-- Parameters assigned at runtime. -->
<xsl:param name="paramCurrentTimestamp">20001231173010</xsl:param>
<xsl:param name="paramCurrentDT" >12/31/2000 5:30:10 PM</xsl:param>
<xsl:param name="paramCurrentCulture">en-US</xsl:param>
<!-- The transformation below provides trivial default copy of everything. -->
<xsl:template match="*|@*">
<xsl:choose>
<xsl:when Text18=”Inactive”><xsl:value-of select=”Inactive”/>.</xsl:when>
<xsl:when Text12=”False”><xsl:value-of select=”False”/>.</xsl:when>
<xsl:otherwise> "ucscPersonEmployeeStatus[text()='']">
<xsl:element name="Disabled">1</xsl:element>
<xsl:copy-of select="." />
</xsl:template>
<xsl:template match="@*">
<xsl:copy />
</xsl:template>
<!-- End of customizable area. -->
</xsl:stylesheet>
解决方案
您忘记关闭</xsl:otherwise>
和</xsl:choose>
元素。修复这些样式表问题,以下可能对您有用:
<?xml version ="1.0" encoding="utf8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<!-- Parameters assigned at runtime. -->
<xsl:param name="paramCurrentTimestamp">20001231173010</xsl:param>
<xsl:param name="paramCurrentDT" >12/31/2000 5:30:10 PM</xsl:param>
<xsl:param name="paramCurrentCulture">en-US</xsl:param>
<!-- The transformation below provides trivial default copy of everything. -->
<xsl:template match="*|@*">
<xsl:choose>
<xsl:when Text18="Inactive">
<xsl:value-of select="Inactive"/>
.</xsl:when>
<xsl:when Text12="False">
<xsl:value-of select="False"/>
.</xsl:when>
<xsl:otherwise> "ucscPersonEmployeeStatus[text()='']">
<xsl:element name="Disabled">1</xsl:element>
<xsl:copy-of select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="@*">
<xsl:copy />
</xsl:template>
<!-- End of customizable area. -->
</xsl:stylesheet>
推荐阅读
- keycloak - Getting Users and groups from Keycloak
- python - SciPy Bernoulli random number generation, different behavior within a for loop for different sample sizes
- javascript - 用于多个 html 元素的通用 JQuery
- python - MaxPooling2D - 位置参数遵循关键字参数
- python - Exception has occurred: ImportError cannot import name 'Rescaling'
- python-3.x - Getting proper callback for multiple listbox
- python - Django skips a url pattern?
- bash - Running a command in a Docker container with variables
- swift - ARView 黑屏
- javascript - 已达到文件观察者数量的系统限制