Skip to content

Instantly share code, notes, and snippets.

@spdustin
Created October 29, 2012 16:36
Show Gist options
  • Save spdustin/3974707 to your computer and use it in GitHub Desktop.
Save spdustin/3974707 to your computer and use it in GitHub Desktop.
XSL Step 3
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" />
<xsl:template match="/">
<table>
<thead>
<tr>
<th>Make</th>
<th>Model</th>
<th>Passengers</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates />
</tbody>
</table>
</xsl:template>
<xsl:template match="/cars/car">
<tr>
<td><xsl:value-of select="@make" /></td>
<td><xsl:value-of select="@model" /></td>
<td><xsl:apply-templates /></td>
</tr>
</xsl:template>
<xsl:template match="passenger">
<p>
<xsl:value-of select="@name" />
</p>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment