Tuesday, December 3, 2013

[WSO2 ESB] XSLT Mediator - XSLT Imports


There can be situations where we want to import xslt scripts to the main xslt script defined in XSLT mediator.
This requirement can be achieved using Resources in XSLT mediator.

Imported xslt file has to be defined as a XSLT Resource.

Following is a sample.

I have following two xslt files.

xslt1.xslt

 
     
         
             
                 
             
             
                 
             
             
                 
             
             
                 
             
         
     
 


xslt2.xslt

 
     
     
         
             
                 
             
         
     
 

xslt1.xslt is included by the xslt2. Both files are stored in the registry under conf:/

Following is a sample proxy service configuration.
 
    
    
       
          
             
          
          
         

Note the resource element of xslt mediator configuration.

  
        
 
Here location should be matched to the 'href' of and key should point to the registry path of the included xslt file. 

Following is the request format to test this proxy configuration.

 
     
     
         
             
                Isuru 
                Udana 
                Male 
                26 
                SriLanka 
             
             
                Ishan 
                Jayawardena 
                Male 
                26 
                SriLanka