0
我正在使用xslt 1.0樣式表工作在xml文件數據上。如何檢查字符串序列/數組中的重複元素?
我在xslt中有一個變量,它包含許多由空格或新行字符分隔的字符串。
即變量爲 「ServiceList」,當我打印它使用follwong,
<xsl:value-of select="$ServiceList"/>
它打印出來之後放
hgd.sdf.gsdf sdf.sdh.duyg dsf.sdf.suos
jhs.sdu.sdfi
hdf.sdi.seij dsf.dsf.diuh
edr.sdi.sdhg dfh.dfg.dfg.fdg.idjf kjs.dfh.dfgj djg.dfs.dgji
我用follwing代碼以分別獲得每個字符串。
<xsl:variable name="tokenizedSample" select="str:tokenize($ServiceList,'
')"/>
<xsl:for-each select="$tokenizedSample">
<xsl:variable name="serviceProvide" select="."/>
<xsl:variable name="tokenized1" select="str:tokenize($serviceProvide,' ')"/>
<xsl:for-each select="$tokenized1">
<xsl:variable name="serviceP" select="."/>
<xsl:value-of select="$serviceP"/>
</xsl:for-each>
</xsl:for-each>
上面的代碼給了我每個字符串作爲單獨的一個。
我必須在上面的序列/數組中有任何重複的字符串。如果重複,它應該顯示字符串正在重複。
容易得多,但讀音字使用XSLT 1.0這樣可以ü建議對這個版本的解決方案。 – balaji 2011-05-19 11:30:50