style-3-NOM-ADJ.xsl
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="html"/> <xsl:template match="/"> <html> <head> <title>Les rubriques Culture et Livres sur lemonde.fr</title> <meta http-equiv="content-type" content="text/html; charset=windows-1250"></meta> </head> <body bgcolor="#5EC3FB" text="#12162E" link="#B40002" alink="#0C340C" vlink="#67284C"> <body background ="./IMAGES/rss-news.jpg"> <table align="center" width="50%" bgcolor="white" bordercolor="#3300FF" border="1"> <tr bgcolor="#12162E"> <td width="90%" valign="top" align="center"><font color="white"><h1><u>Extraction de patrons</u>:<font color="red"><b> NOM</b></font> <font color="blue"><b> ADJ</b></font></h1></font></td> </tr> <tr><td> <blockquote><xsl:apply-templates select="./document/article/element"/></blockquote></td></tr> </table> <p><a href="./index.htm"><img src="./IMAGES/index.gif"></img></a></p> </body> </body> </html> </xsl:template><xsl:template match="element"> <xsl:choose> <xsl:when test="(./data[contains(text(),'NOM')]) and (following-sibling::element[1][./data[contains(text(),'ADJ')]])"> <font color="red"><xsl:value-of select="./data[3]"/></font><xsl:text> </xsl:text> </xsl:when> <xsl:when test="(./data[contains(text(),'ADJ')]) and (preceding-sibling::element[1][./data[contains(text(),'NOM')]])"> <font color="blue"><xsl:value-of select="./data[3]"/></font><br/> </xsl:when> </xsl:choose> </xsl:template> </xsl:stylesheet>