Archive | XSLT RSS feed for this section

XSLT – grouping or ordering elements

21 Mar

To do a rudimentary sort of elements :



  
      
      
    
      
  

For more advanced grouping see:
http://www.jenitennison.com/xslt/grouping/muenchian.html
and
http://www.thescripts.com/forum/thread86649.html

Split a newline separated element and do work on each…

15 Mar

Template to split input that has newlines in it.
Note the ‘append-pad’ template is also used (see other post) to nicely space things.

e.g. input is:

John Doe 1 Blacks Rd Beverly Hills California 90210

and you want to pass in something for the right hand side too, you pass it in | seperated.
e.g:

  
    
        
    
    
      
  

Code that actually does the work below:

  
      
      
      
      
        
          
          
          
        
      
      
      
      
      

      
          
              
              
          
      
  

XSLT – very useful prepend-pad and append-pad

15 Mar

Found over: here

This is very useful to make sure things appear in the correct ‘column’.

Basically so you can make sure each value has been padded out with spaces (or whatever).

To use:

 
    
      
      
      
    
  

The actual templates that do the work:



  
     
    
    
    
    
    
      
        
          
          
          
          
        
      
      
        
<!--      
-->
      
    
  


  
     
    
    
    
      
        
          
          
          
        
      
      
        
      
    
  

New lines for text output.

15 Mar

New lines in text are difficult to deal with, they are often stripped or added when not wanted.

To force a new line, use: