Concatting a tokenized String



Say I have the following string in an XML Text node: Johnson|John|Dr.|Jr.


I can tokenize this string with the XSLT function tokenize(...) (so far so good). Now I want to format the tokens for presentation, expected result would be: Dr. John Johnson Jr. In case my XML doesn't have all fields, I get a value like Smith|Will (blank values are omitted) which I want to present as simply Will Smith.


Note that the order of the fields in my formatted representation of the name isn't necessarily the same as the tokenized string.


So I'm looking at string-join and concat, but can't figure out how to use them without ending up with unnecessary spaces at the end for the blank values.


No comments:

Post a Comment