Search This Blog

Tuesday, December 11, 2012

Simple sflight XSLT transformation for HTML

 <?sap.transform simple?>  
 <!-- NOTE!! For XSLT reference check http://www.w3schools.com/xsl/default.asp -->  
 <tt:transform xmlns:tt="http://www.sap.com/transformation-templates" xmlns:ddic="http://www.sap.com/abapxml/types/dictionary" xmlns:def="http://www.sap.com/abapxml/types/defined" version="1.0">  
 <!-- <tt:root name="ROOT" type="?"/>-->  
  <tt:root name="GT_OUT" type="ddic:TY_FLIGHTS"/>  
  <tt:template>  
   <HTML>  
    <HEAD>  
     <style>  
       .col {  
          border-width: 1px;  
          padding: 7px;  
          border-style: solid;  
          border-color: #DDDDDD;  
          border-collapse:collapase;  
          }  
        .t2 {  
           border-width: 0px;  
          }  
      .space {  
          padding-bottom: 3em;  
          }  
    .myTable2  {  
           font-family: arial;  
           font-size:10pt;  
           width:100%;  
           border-style:solid;  
           border-width: 1px;  
           border-color: #424242;  
           border-collapse: collapse;  
          }  
    .myTable2 th.p {width:7%;color="red";}  
    .myTable2 th.m {width:24%;}  
    .myTable2 th.a {width:34%;}  
    .myTable2 th.k {width:13%;}  
    .myTable2 th.n {width:13%;}  
    .myTable2 th  
          { background-color:#A9D0F5;  
           padding:2px;  
           border:1px solid #424242;  
          }  
    .myTable2 td.p {width:7%;color="red";}  
    .myTable2 td.m {width:24%;}  
    .myTable2 td.a {width:34%;}  
    .myTable2 td.k {width:13%;}  
    .myTable2 td.n {width:13%;}  
    .myTable2 td  
          { padding:2px;  
           border:1px solid #424242;  
          }  
    .myTable2 tr {  
           border-style:solid;  
           border-width:1px;  
           border-color:#dee3ef;  
          }  
     </style>  
    </HEAD>  
    <BODY>  
     <img alt="Allergan" src="https://allergandirect.allergan.com:81/Document/images/image_agn.bmp" width="200"/>  
     <BR/>  
     <H2 align="center">  
      <font color="red">  
       DEMO: Use XSLT to create XLS attachment  
       <BR/>  
       Warning: Size of attachment can get large  
      </font>  
     </H2>  
     <H2>  
      This email was produced by program ZZFLOTH_TRANS_EMAIL_XLS_HTM  
     </H2>  
     <H3>  
      Email Attachment XSLT: ZZFLOTH_TRANS_XLS  
     </H3>  
     <H3>  
      Email Body XSLT: ZZFLOTH_TRANS_HTM  
     </H3>  
     <BR/>  
     <table class="myTable2">  
      <tr>  
       <th class="p">Airline Code</th>  
       <th class="m">Flight Connection</th>  
       <th class="a">Flight date</th>  
       <th class="k">Currency</th>  
       <th class="n">Airfare</th>  
      </tr>  
      <tt:loop ref=".GT_OUT">  
       <tr>  
        <td class="p">  
         <tt:value ref="$ref.CARRID"/>  
        </td>  
        <td class="m">  
         <tt:value ref="$ref.CONNID"/>  
        </td>  
        <td class="a">  
         <tt:value ref="$ref.FLDATE"/>  
        </td>  
        <td class="k">  
         <tt:value ref="$ref.CURRENCY"/>  
        </td>  
        <td class="n">  
         <tt:value ref="$ref.PRICE"/>  
        </td>  
       </tr>  
      </tt:loop>  
     </table>  
     <BR/>  
    </BODY>  
   </HTML>  
  </tt:template>  
 </tt:transform>  

No comments: