gpt4 book ai didi

xslt - 基于 webkit 引擎的浏览器中的 substring-before() 和 substring-after 问题

转载 作者:行者123 更新时间:2023-12-04 06:32:07 27 4
gpt4 key购买 nike

下面您可能会看到 xslt 代码来生成单选按钮。它适用于 Firefox 和 Opera,但不适用于 arora(使用 webkit 引擎)。简而言之,我没有尝试任何其他浏览器使用 webkit 引擎

<xsl:template name="createRadioButton">
<xsl:param name="list" /><!-- something like : true|false|bla|bla -->
<xsl:param name="delimiter" /> <!-- "|" -->
<xsl:param name="nameofradio" /> <!-- sampleName -->
<xsl:param name="valueofradio" /> <!-- sampleValue -->
<xsl:variable name="newlist">
<xsl:choose>
<xsl:when test="contains($list, $delimiter)">
<xsl:value-of select="normalize-space($list)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(normalize-space($list), $delimiter)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- problem is these two lines. When I assign something else it works.-->
<xsl:variable name="first" select="substring-before($newlist, $delimiter)" />
<xsl:variable name="remaining" select="substring-after($newlist, $delimiter)" />
<xsl:element name="input">
<xsl:attribute name="type">radio</xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select="$nameofradio"/></xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="$first"/></xsl:attribute>
<xsl:choose>
<xsl:when test="@hassection='true'">
<xsl:attribute name="onclick">showHiddenTable(this.value);validateFormElement(this.name,this.value);</xsl:attribute>
</xsl:when>
<xsl:when test="$valueofradio = $first">
<xsl:attribute name="checked">checked</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="onclick">validateFormElement(this.name,this.value)</xsl:attribute>
</xsl:otherwise>
</xsl:choose>

</xsl:element>
<xsl:value-of select="$first" />
<xsl:if test="$remaining">
<xsl:call-template name="createRadioButton">
<xsl:with-param name="list" select="$remaining" />
<xsl:with-param name="delimiter"><xsl:value-of select="$delimiter"/></xsl:with-param>
<xsl:with-param name="nameofradio"><xsl:value-of select="$nameofradio"/></xsl:with-param>
<xsl:with-param name="valueofradio"><xsl:value-of select="$valueofradio"/></xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>

我在网上搜索没有看到有人遇到我的问题。

谢谢。

最佳答案

当我使用我正在使用的 9 个 XSLT(1.0 和 2.0)处理器中的每一个执行它时,这种转换产生了预期的结果。

我通过以下方式调用您的模板:

<xsl:template match="/">
<table>
<xsl:call-template name="createRadioButton">
<xsl:with-param name="list" select="'true|false|bla|bla'"/>
<xsl:with-param name="delimiter" select="'|'"/>
<xsl:with-param name="nameofradio" select="'Phillips'"/>
<xsl:with-param name="valueofradio" select="200"/>
</xsl:call-template>
</table>
</xsl:template>

因此,这似乎是一个错误 -- 向供应商报告。

关于xslt - 基于 webkit 引擎的浏览器中的 substring-before() 和 substring-after 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5271266/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com