如何避免从字符串变量中获取重复的字符串?
我有一个包含字符串值的变量 serviceProvideList
。
我使用以下代码分别获取每个字符串:
<xsl:variable name="tokenizedSample" select="str:tokenize($serviceProvideList,'
')"/>
<xsl:for-each select="$tokenizedSample">
<xsl:variable name="weakProvide" select="."/>
<xsl:variable name="tokenized" select="str:tokenize($weakProvide,' ')"/>
<xsl:for-each select="$tokenized">
<xsl:variable name="weakP" select="."/>
<xsl:value-of select="$weakP"/>
</xsl:for-each>
</xsl:for-each>
如何避免变量 serviceProvideList
中重复值?
I have a variable serviceProvideList
that contains string values.
I use following code to get each string separately:
<xsl:variable name="tokenizedSample" select="str:tokenize($serviceProvideList,'
')"/>
<xsl:for-each select="$tokenizedSample">
<xsl:variable name="weakProvide" select="."/>
<xsl:variable name="tokenized" select="str:tokenize($weakProvide,' ')"/>
<xsl:for-each select="$tokenized">
<xsl:variable name="weakP" select="."/>
<xsl:value-of select="$weakP"/>
</xsl:for-each>
</xsl:for-each>
How can I avoid repeating values in the variable serviceProvideList
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从
for-each
循环中排除具有相同值的前缀的标记:Exclude tokens, which have precedings with same value, from
for-each
loop :