我见过 模式 对于使用xslt 1.0卡住的人来说,使用translate函数将字符串转换为较低(或大写)。
是否有一种优雅的方式只是将字符串的第一个字母小写?
TestCase => testCase
我见过 模式 对于使用xslt 1.0卡住的人来说,使用translate函数将字符串转换为较低(或大写)。
是否有一种优雅的方式只是将字符串的第一个字母小写?
TestCase => testCase
例如,如果您的字符串位于名为的属性中 name
:
<xsl:value-of select="concat(translate(substring(@name, 1, 1), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), substring(@name, 2))"/>
例如,如果您的字符串位于名为的属性中 name
:
<xsl:value-of select="concat(translate(substring(@name, 1, 1), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), substring(@name, 2))"/>
你应该能够结合起来 子 和 CONCAT 用翻译来做到这样:
concat(translate(substring(s,1,1), $smallcase, $uppercase),substring(s,2))
使用XPath translate
函数,将字符串分成第一个字符和其余字符。这将需要使用多个变量来保存中间结果的有点长卷绕的XSLT。
XSLT有一个子字符串函数,因此您可以将该模式与子字符串函数一起使用以获得所需的内容。