1

I have used <xsl:value-of select="translate($var,'|',' | ')"/> where var is in format of ABCD|EFGH|AWED|WERS|GGHS|KLIY|GYOK . The out put i am getting is : ABCD EFGH AWED WERS GGHS KLIY GYOK. i.e. all the pipes are lost. What is the reason for this... ?

apratik
  • 141
  • 2
  • 11

1 Answers1

2

Translate replaces the first character from the first string with the first character from the second string, the 2nd from 1st with 2nd from 2nd and so on. So here pipe is being replaced with space, and the next 2 characters of the second string are ignored.

In XSLT 2.0 there's a replace function. However in XSLT 1.0 there isn't, so you have to use a workaround. See here for a solution: XSLT string replace

Community
  • 1
  • 1
JohnLBevan
  • 22,735
  • 13
  • 96
  • 178