开发者

how to avoid getting repeated strings from string variable?

开发者 https://www.devze.com 2023-03-06 20:24 出处:网络
I have a variable servicePro开发者_开发百科videList that contains string values. I use following code to get each string separately:

I have a variable servicePro开发者_开发百科videList that contains string values.

I use following code to get each string separately:

<xsl:variable name="tokenizedSample" select="str:tokenize($serviceProvideList,'&#xa;')"/>

<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?


Exclude tokens, which have precedings with same value, from for-each loop :

<xsl:for-each select="$tokenizedSample[ not(preceding-sibling::* = .) ]">
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号