xsl-list
[Top] [All Lists]

RE: translate

2004-03-24 08:17:34
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(_at_)nag(_dot_)co(_dot_)uk] 
Sent: Wednesday, March 24, 2004 7:35 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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
________________________________________________________________________

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
You are subscribed as: m(_dot_)david(_at_)mdptws(_dot_)com
To unsubscribe, go to:
http://lists.mulberrytech.com/unsub.php/xsl-list/m(_dot_)david(_at_)mdptws(_dot_)com
or e-mail:
<mailto:xsl-list-unsubscribe-m(_dot_)david=mdptws(_dot_)com(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--



<Prev in Thread] Current Thread [Next in Thread>