This commit is contained in:
danrega
2024-01-31 15:40:37 +01:00
parent 021148a965
commit 7769f699c8
10 changed files with 325 additions and 45 deletions

View File

@@ -1,7 +1,49 @@
<?sap.transform simple?><tt:transform xmlns:tt="http://www.sap.com/transformation-templates"><tt:root name="CARRIER_INFO"/><tt:template>
<html><body><h2>Information about Carriers</h2><table border="1">
<tr><td><b>ID</b></td><td><b>Name</b></td><td><b>Currency</b></td><td><b>Website</b></td></tr>
<tt:loop ref=".CARRIER_INFO"><tr><td><tt:value ref="$ref.carrid"/></td><td><tt:value ref="$ref.carrname"/></td>
<td><tt:value ref="$ref.currcode"/></td><td><a><tt:attribute name="href" value-ref="$ref.url" /><tt:value ref="$ref.url"/></a></td></tr></tt:loop>
</table></body></html></tt:template>
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="CARRIER_INFO"/>
<tt:template>
<html>
<body>
<h2>Information about Carriers</h2>
<table border="1">
<tr>
<td>
<b>ID</b>
</td>
<td>
<b>Name</b>
</td>
<td>
<b>Currency</b>
</td>
<td>
<b>Website</b>
</td>
</tr>
<tt:loop ref=".CARRIER_INFO">
<tr>
<td>
<tt:value ref="$ref.carrid"/>
</td>
<td>
<tt:value ref="$ref.carrname"/>
</td>
<td>
<tt:value ref="$ref.currcode"/>
</td>
<td>
<a>
<tt:attribute name="href" value-ref="$ref.url"/>
<tt:value ref="$ref.url"/>
</a>
</td>
</tr>
</tt:loop>
</table>
</body>
</html>
</tt:template>
</tt:transform>

View File

@@ -5,7 +5,7 @@
<ATTRIBUTES>
<XSLTDESC>ZDEMO_ABAP_ST_CARRIERS_HTML</XSLTDESC>
<LANGU>E</LANGU>
<DESCRIPT>Simple Transformation Demo</DESCRIPT>
<DESCRIPT>ST Demo</DESCRIPT>
</ATTRIBUTES>
</asx:values>
</asx:abap>

View File

@@ -1,4 +1,23 @@
<?sap.transform simple?><tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="STRING_TABLE"/><tt:template><html><body><h2>Content of String Table</h2><table border="1">
<tt:loop ref=".STRING_TABLE"><tr><td><tt:value ref="$ref"/></td></tr></tt:loop></table>
</body></html></tt:template></tt:transform>
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="STRING_TABLE"/>
<tt:template>
<html>
<body>
<h2>Content of String Table</h2>
<table border="1">
<tt:loop ref=".STRING_TABLE">
<tr>
<td>
<tt:value ref="$ref"/>
</td>
</tr>
</tt:loop>
</table>
</body>
</html>
</tt:template>
</tt:transform>

View File

@@ -5,7 +5,7 @@
<ATTRIBUTES>
<XSLTDESC>ZDEMO_ABAP_ST_STRTAB_HTML</XSLTDESC>
<LANGU>E</LANGU>
<DESCRIPT>Simple Transformation Demo</DESCRIPT>
<DESCRIPT>ST Demo</DESCRIPT>
</ATTRIBUTES>
</asx:values>
</asx:abap>

View File

@@ -1,6 +1,22 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:strip-space elements="*"/>
<xsl:template match="node()|@*"><xsl:copy><xsl:apply-templates select="node()|@*"/></xsl:copy></xsl:template>
<xsl:template match="*[MAXSEATS and OCCSEATS]"><xsl:copy><xsl:apply-templates select="node()|@*"/>
<FREESEATS><xsl:value-of select="MAXSEATS - OCCSEATS"/></FREESEATS>
<OCCUPANCYRATE><xsl:value-of select="format-number(OCCSEATS div MAXSEATS * 100, '##.##')"/></OCCUPANCYRATE>
</xsl:copy></xsl:template></xsl:stylesheet>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[MAXSEATS and OCCSEATS]">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<FREESEATS>
<xsl:value-of select="MAXSEATS - OCCSEATS"/>
</FREESEATS>
<OCCUPANCYRATE>
<xsl:value-of select="format-number(OCCSEATS div MAXSEATS * 100, '##.##')"/>
</OCCUPANCYRATE>
</xsl:copy>
</xsl:template>
</xsl:transform>