xml – 将整数值转换为重复的字符
发布时间:2020-12-16 07:45:09 所属栏目:百科 来源:网络整理
导读:当我的XSL样式表遇到此节点时: node attribute="3"/ …它应该将其转换为此节点: node attribute="***"/ 我的模板匹配属性并重新创建它,但我不知道如何将值设置为:字符’*’重复的次数与原始属性的值一样多. xsl:template match="node/@attribute" xsl:var
当我的XSL样式表遇到此节点时:
<node attribute="3"/> …它应该将其转换为此节点: <node attribute="***"/> 我的模板匹配属性并重新创建它,但我不知道如何将值设置为:字符’*’重复的次数与原始属性的值一样多. <xsl:template match="node/@attribute"> <xsl:variable name="repeat" select="."/> <xsl:attribute name="attribute"> <!-- What goes here? I think I can do something with $repeat... --> </xsl:attribute> </xsl:template> 谢谢!
一个相当肮脏但务实的方法是打电话给你期望在属性中看到的最高数字,然后使用
substring("****...",1,$repeat) 你在那个字符串中有多少* s就是你期望的最大数量.但我希望有更好的东西! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |