Created
September 4, 2018 15:19
-
-
Save amundo/50ce2d2fd6b947f167345e473034ff47 to your computer and use it in GitHub Desktop.
an xml file with an xsl “stylesheet”
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<?xml-stylesheet type="text/xsl" href="movies.xsl" ?> | |
<collection> | |
<movie> | |
<title>Happy Gilmore</title> | |
<year>1996</year> | |
<genre>comedy</genre> | |
</movie> | |
<movie> | |
<title>Rango</title> | |
<year>2011</year> | |
<genre>anime</genre> | |
</movie> | |
<movie> | |
<title>Three Kings</title> | |
<year>1999</year> | |
<genre>action</genre> | |
</movie> | |
</collection> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:template match="/collection"> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>movies</title> | |
<style> | |
body {background:tan;} | |
ul{ margin: 1em; } | |
</style> | |
</head> | |
<body> | |
<xsl:for-each select="movie"> | |
<ul> | |
<li> | |
<xsl:value-of select="title" /> | |
</li> | |
<li> | |
<xsl:value-of select="year" /> | |
</li> | |
<li> | |
<xsl:value-of select="genre" /> | |
</li> | |
</ul> | |
</xsl:for-each> | |
</body> | |
</html> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
based on https://www.youtube.com/watch?v=BujLy71JY1k