Created
October 5, 2015 06:11
-
-
Save redknitin/b89eb6292b04826c0cad to your computer and use it in GitHub Desktop.
XSLT test
This file contains hidden or 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"?> | |
| <?xml-stylesheet type="text/xsl" href="movies.xsl"?> | |
| <movies> | |
| <movie name="Pirates of the Caribbean" /> | |
| <movie name="Lord of the Rings" /> | |
| </movies> |
This file contains hidden or 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="/"> | |
| <html><head> | |
| </head><body> | |
| <xsl:for-each select="movies/movie"> | |
| <div>Name: <xsl:value-of select="@name" /></div> | |
| <!-- xsl:if test="price>10" --> | |
| <!-- xsl:choose xsl:when xsl:otherwise --> | |
| </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
Here are my suggested changes. Tested with Saxon9.XSLT 2 not 1. HTML5 output.
What you have works. But a second template for movies is preferable over for-each.
Ian