Re:Google is killing the open web, part 2
by ndriscoll on Wednesday November 19, 2025 @09:16AM
(#45979755)
What an odd comment to have as a sibling to mine from yesterday showing how to do it with two small templates in xsl (after a minor tweak to the xml):
<xsl:template match="series">
<h2><xsl:value-of select="@name"/></h2>
<table>
<tr><th>Skylanders figure</th><th>Note</th></tr>
<xsl:apply-templates select="/skylanders/figure[@series=current()/@id]"><xsl:sort select="name"/></xsl:apply-templates>
</table>
</xsl:template>
<xsl:template match="figure">
<tr class="element-{ @element }">
<td><xsl:value-of select="@name" /></td>
<td><xsl:value-of select="@note" /></td>
</tr>
</xsl:template>
No explicit loops necessary.
Less than the amount of XSL you'd need.
> Those hundreds of lines are the same copy/pasted if statement with 5 different conditions.
With a programming language, you could have used loops.