RE: [xsl] translate

Subject: RE: [xsl] translate
From: "M. David Peterson" <m.david@xxxxxxxxxx>
Date: Wed, 24 Mar 2004 08:17:34 -0700
You also need to remember that translate() is not a regex-styled pattern
matching function but instead a way to match individual characters in
the second position of the function to a string in the first position
and replace them with the character within the third position function
found in the same numerical position of the second position of the
function.  Or in other words translate('cat',
'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') would return
'CAT'.  What it seems like you are trying to do (replace each instance
of one entity with the value of another) is a much more complicated
process that requires using a recursive named-template method.  Examples
of this method can be found all over the archives.

Best of luck!

<M:D/>

-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx] 
Sent: Wednesday, March 24, 2004 7:35 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] translate


> How can I make this work?

translate() takes three strings as arguments you have given a Node set
as the first, which is OK, it will take the string value of that node,
but your second two arguments are just floating characters, so a syntax
error, XPath strings have to be in "" or ''
so you want translate(EPAPER,'&#x002D;','&#x2013;')

David



-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread