Advertisement
rplantiko

Transformation for CL_DEMO_OUTPUT

Jul 6th, 2023 (edited)
1,404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 3.26 KB | None | 0 0
  1. <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ab="http://www.sap.com/abapdemos" exclude-result-prefixes="ab" version="2.0">
  2.   <xsl:output doctype-public="XSLT-compat" encoding="UTF-8" indent="yes" method="html" omit-xml-declaration="yes"/>
  3.  
  4. <!-- See discussion in the comment to Horst Keller's blogpost on class CL_DEMO_OUTPUT
  5. https://blogs.sap.com/2021/12/08/cl_demo_output-invigorated/comment-page-1/#comment-679898
  6. -->
  7.  
  8.   <xsl:template match="ab:abapOutput">
  9.     <html>
  10.       <head>
  11.         <meta content="Data" name="Output"/>
  12.         <style type="text/css">
  13.            body    { font-family: Arial; font-size: 90%; }
  14.            table   { font-family: Arial; font-size: 90%; }
  15.            caption { font-family: Arial; font-size: 90%;  font-weight:bold; text-align:left; }
  16.            span.heading1 {font-size: 150%; color:#000080; font-weight:bold;}
  17.            span.heading2 {font-size: 135%; color:#000080; font-weight:bold;}
  18.            span.heading3 {font-size: 120%; color:#000080; font-weight:bold;}
  19.            span.heading4 {font-size: 105%; color:#000080; font-weight:bold;}
  20.            span.normal   {font-size: 100%; color:#000000; font-weight:normal;}
  21.            span.nonprop  {font-family: Courier New; font-size: 100%; color:#000000; font-weight:400;}
  22.            span.nowrap   {white-space:nowrap; }
  23.            span.nprpnwrp {font-family: Courier New; font-size: 100%; color:#000000; font-weight:400; white-space:nowrap; }
  24.            tr.header   {background-color:#D3D3D3; }
  25.            tr.body     {background-color:#EFEFEF; }
  26.            tr.body &gt; td {white-space:nowrap}
  27.            table.nested_table, .nested_table td { border: 1px solid; border-collapse: collapse; padding: 4px; text-align:center; }
  28.            .nested_table th { border: 1px solid; border-collapse: collapse; background-color: #FFFFE0; padding: 4px; }
  29.            </style>
  30.       </head>
  31.       <xsl:apply-templates/>
  32.     </html>
  33.   </xsl:template>
  34.  
  35.   <xsl:template match="ab:nested[ab:name = 'Table' or ab:name = 'Structure']">
  36.     <table class="nested_table">
  37.       <xsl:apply-templates/>
  38.     </table>
  39.   </xsl:template>
  40.  
  41.   <xsl:template match="ab:name[.='Table' or .='Structure']">
  42.   </xsl:template>
  43.  
  44.   <xsl:template match="ab:name">
  45.     <caption><span class="nowrap">
  46.       <xsl:value-of select="."/>
  47.     </span></caption>
  48.   </xsl:template>
  49.  
  50.   <xsl:template match="ab:output">
  51.     <body>
  52.       <xsl:apply-templates/>
  53.     </body>
  54.   </xsl:template>
  55.  
  56.   <xsl:template match="ab:object">
  57.     <table border="0" summary="data display" title="ABAP Data">
  58.       <xsl:apply-templates/>
  59.     </table>
  60.   </xsl:template>
  61.  
  62.  
  63.   <xsl:template match="ab:text">
  64.     <p>
  65.       <xsl:apply-templates/>
  66.     </p>
  67.   </xsl:template>
  68.  
  69.   <xsl:template match="ab:components">
  70.     <tr>
  71.       <xsl:apply-templates/>
  72.     </tr>
  73.   </xsl:template>
  74.  
  75.   <xsl:template match="ab:compName">
  76.     <th>
  77.       <xsl:apply-templates/>
  78.     </th>
  79.   </xsl:template>
  80.  
  81.   <xsl:template match="ab:data">
  82.     <xsl:apply-templates/>
  83.   </xsl:template>
  84.  
  85.   <xsl:template match="ab:row">
  86.     <tr class="body">
  87.       <xsl:apply-templates/>
  88.     </tr>
  89.   </xsl:template>
  90.  
  91.   <xsl:template match="ab:compValue">
  92.     <td>
  93.       <xsl:apply-templates/>
  94.     </td>
  95.   </xsl:template>
  96.  
  97. </xsl:transform>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement