gpt4 book ai didi

xslt - 如何从字符串中删除连字符 +xslt

转载 作者:行者123 更新时间:2023-12-04 02:10:57 28 4
gpt4 key购买 nike

如何从“19650512-0065”到“196505120065”这样的字符串中删除连字符

使用这个模板:传递 theID =

   <xsl:template name="unformatLFPartyID">
<xsl:param name="theID" select="." />

<xsl:variable name="idSuffix" select="string-length($theID) - 3" />

<xsl:choose>
<xsl:when test="contains($theID,'-')">
<xsl:value-of select="substring($theID,0,$idSuffix)" />
<xsl:value-of select="substring($theID, $idSuffix)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$theID" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>

最佳答案

尝试将 xsl:variable 和整个 xsl:choose 替换为:

<xsl:value-of select="translate($theID,'-','')"/>

关于xslt - 如何从字符串中删除连字符 +xslt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38482513/

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