xsl-list
[Top] [All Lists]

Re: [xsl] Multiple replace() in XSLT 2

2019-05-16 14:15:11
Can you use XSLT 3 (if you're using latest Saxon then XSLT 3 is an option)?

If so, then xsl:iterate is probably easier for this than recursion.

If you are limited to XSLT 2 then I'd probably use a recursive function to do 
it.

Cheers,

Eliot
--
Eliot Kimber
http://contrext.com
 

On 5/16/19, 1:59 PM, "Rick Quatro rick(_at_)rickquatro(_dot_)com" 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

    Hi,
     
    I have a look up file of find/change pairs that I have to apply to a text 
node in my XML document. I am using XSLT 2. Here is an example of the lookup 
file:
     
    <?xml version="1.0" encoding="UTF-8"?>
    <findchange_lookup>
        <findchange find="Eicas" change="EICAS"/>
        <findchange find="Ulb" change="ULB"/>
    </findchange_lookup>
    
    
    I am reading this in as a global variable, but I am not sure the best 
approach for doing multiple replacements on the node. I can use recursion like 
in XSLT 1, but I can't think of how to do this in XSLT 2. There could be any 
number of <findchange> elements in my lookup file. Any pointers would be 
appreciated. Thank you very much.
     
    Rick
     
    Rick Quatro
    Carmen Publishing Inc.
    rick(_at_)frameexpert(_dot_)com
    585-729-6746
    www.frameexpert.com/store/
     
     
     
     
    
    XSL-List info and archive 
<http://www.mulberrytech.com/xsl/xsl-list>EasyUnsubscribe 
<http://lists.mulberrytech.com/unsub/xsl-list/1278982>
    (by email <>)
    
    
    
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

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