Fix xsl error

This commit is contained in:
hodasemi 2018-11-13 22:33:33 +01:00
parent 8d65583ab7
commit 591de1e5eb
2 changed files with 56 additions and 36 deletions

View file

@ -1,45 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="w3.org/1999/XSL/Transform"> <!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/"> <xsl:template match="/">
<html> <html>
<head>
<meta charset="utf-8"></meta>
<title>Page Title</title>
<meta name="description" content="Die Daten der Welt im Überblick"></meta>
<meta name="author" content="Michael Hübener und Selina Marie-Alice Schönherr"></meta>
<meta name="keywords" content="Welt, Daten, Überblick, HTML"></meta>
<meta name="viewport" content="width=device-width, initial-scale=1"></meta>
<link rel="stylesheet" type="text/css" media="screen" href="css/reset.css"></link>
<link rel="stylesheet" type="text/css" media="screen" href="css/main.css"></link>
<script src="js/table.js"></script>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400" rel="stylesheet"></link>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.2/css/all.css"
integrity="sha384-/rXc/GQVaYpyDdyxK+ecHPVYJSN9bmVFBvjA/9eOB+pb3F2w2N6fc5qB9Ew5yIns"
crossorigin="anonymous"></link>
</head>
<body> <body>
<h1>World Data Overview ...</h1> <h1>World Data Overview ...</h1>
<table> <div class="table-wrapper">
<tr> <table>
<th>id</th>
<th>name</th>
<th>birth_rate_per_1000</th>
<th>cell_phones_per_100</th>
<th>children_per_woman</th>
<th>electricity_consumption_per_capita</th>
<th>gdp_per_capita</th>
<th>gdp__per__capita__growth</th>
<th>inflation_annual</th>
<th>internet_user_per_100</th>
<th>life_expectancy</th>
<th>military_expenditure_percent_of_gdp</th>
<th>gps_lat</th>
<th>gps_long</th>
</tr>
<xsl:for-each select="Countries/Country">
<tr> <tr>
<td><xsl:value-of select="id"/></td> <th>id</th>
<td><xsl:value-of select="name"/></td> <th>name</th>
<td><xsl:value-of select="birth_rate_per_1000"/></td> <th>birth_rate_per_1000</th>
<td><xsl:value-of select="cell_phones_per_100"/></td> <th>cell_phones_per_100</th>
<td><xsl:value-of select="children_per_woman"/></td> <th>children_per_woman</th>
<td><xsl:value-of select="electricity_consumption_per_capita"/></td> <th>electricity_consumption_per_capita</th>
<td><xsl:value-of select="gdp_per_capita"/></td> <th>gdp_per_capita</th>
<td><xsl:value-of select="gdp__per__capita__growth"/></td> <th>gdp__per__capita__growth</th>
<td><xsl:value-of select="inflation_annual"/></td> <th>inflation_annual</th>
<td><xsl:value-of select="internet_user_per_100"/></td> <th>internet_user_per_100</th>
<td><xsl:value-of select="life_expectancy"/></td> <th>life_expectancy</th>
<td><xsl:value-of select="military_expenditure_percent_of_gdp"/></td> <th>military_expenditure_percent_of_gdp</th>
<td><xsl:value-of select="gps_lat"/></td> <th>gps_lat</th>
<td><xsl:value-of select="gps_long"/></td> <th>gps_long</th>
</tr> </tr>
</xsl:for-each> <xsl:for-each select="Countries/Country">
</table> <tr>
<td><xsl:value-of select="id"/></td>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="birth_rate_per_1000"/></td>
<td><xsl:value-of select="cell_phones_per_100"/></td>
<td><xsl:value-of select="children_per_woman"/></td>
<td><xsl:value-of select="electricity_consumption_per_capita"/></td>
<td><xsl:value-of select="gdp_per_capita"/></td>
<td><xsl:value-of select="gdp__per__capita__growth"/></td>
<td><xsl:value-of select="inflation_annual"/></td>
<td><xsl:value-of select="internet_user_per_100"/></td>
<td><xsl:value-of select="life_expectancy"/></td>
<td><xsl:value-of select="military_expenditure_percent_of_gdp"/></td>
<td><xsl:value-of select="gps_lat"/></td>
<td><xsl:value-of select="gps_long"/></td>
</tr>
</xsl:for-each>
</table>
</div>
</body> </body>
</html> </html>
</xsl:template> </xsl:template>

View file

@ -79,6 +79,8 @@ class WorldDataParser {
$xsl = new XSLTProcessor(); $xsl = new XSLTProcessor();
$xsl->importStyleSheet($xsl_doc); $xsl->importStyleSheet($xsl_doc);
echo $xsl->transformToXML($xml_doc); $html = $xsl->transformToXML($xml_doc);
echo $html;
} }
} }