You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Greg McCreath <Gr...@intellect.be> on 2003/04/07 10:38:03 UTC

More % sign tokenisation

Hi all,
 
My input document contains lines that have multiple 'tokens' that need
replacing with xml nodes.  Tokens are identified by a percent sign.  An
example of a input line with tokens looks like the following:
 
"Welcome %name1 %name2.  You have received a bonus of %bonus points.
Your points expire on %expire365"
 
It would be converted to :
 
<line>Welcome <field key="name1"/> <field key="name2"/>.  You have
received a bonus of <field key="bonus"/> points.  Your points expire on
<field key="expiry" param="365"/></line>
 
Not being an XSL guru, I can't seem to find any way of successively
performing multiple operation on a string in this fashion.  That is,
replacing all tokens of like, say, %name1, and then doing %name2 and so
on.
 
With no 'variables' this seems a little awkward.  Can anyone provide an
example or some hints on how I might replace a number of different
tokens in a string?
 
Many thanks.
 
Greg.