L'exemple suivant sélectionne tous les noeuds formés par des balises "project":
<xsl:template match="project">
......
</xsl:template>
L'exemple suivant sélectionne <title> qui est un enfant de <project>:
<xsl:template match="project/title">
......
</xsl:template>
L'exemple suivant sélectionne <title>, un descendant de <project>:
<xsl:template match="project//title">
......
</xsl:template>
<xsl:template match="/">
<html> <body>
<xsl:apply-templates/>
</body> </html>
</xsl:template>
<xsl:template match="page">
<xsl:apply-templates select="title"/>
</xsl:template>
<xsl:template match="project">
<P>
<xsl:value-of select="problem/title"/>
</P>
</xsl:template>
Syntaxe spéciale pour insérer la valeur d'un objet dans un string d'attribut utilisé dans l'output d'un template: {....}
<xsl:template match="contact-info">
....
<a href="mailto:{@email}"><xsl:value-of select="@email"/></a>
...
<xsl:template match="animal">
Nom:<xsl:value-or select="@name"/>
<br> Couleurs:
<xsl:value-of select="couleur"/>
<xsl:if test="position()!=last()">, </xsl:if>
</xsl:template>
<animal name="zebre"> <couleur>noir</couleur> <couleur>blanc</couleur> <couleur>bleu</couleur> </animal>
Nom: zebre
Couleur: noir, blanc, bleu
<xsl:template match="animal">
<xsl:choose>
<xsl:when test="@couleur='noir'">
<P style="color:black">
<xsl:value-of select="."/>
</P>
</xsl:when>
<xsl:when test="@couleur='bleu'">
<P style="color:blue">
<xsl:value-of select="."/>
</P>
</xsl:when>
<xsl:when test="pattern">
...
</xsl:when>
<xsl:otherwise>
<P style="color:green">
<xsl:value-of select="."/>
</P>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="ROWSET">
<table border="2" cellspacing="1" cellpadding="6">
<xsl:for-each select="ROW"> <tr>
<td><xsl:value-of select="id"/></td>
<td><xsl:value-of select="login"/></td>
<td><xsl:value-of select="fullname"/></td>
<td bgcolor="tan"><a href="{url}"><xsl:value-of select="url"/></a></td>
<td><xsl:value-of select="food"/></td>
<td><xsl:value-of select="work"/></td>
<td><xsl:value-of select="love"/></td>
<td><xsl:value-of select="leisure"/></td>
</tr> </xsl:for-each>
</table>
</xsl:template>