Écrire le programme XSLT permettant de transformer le fichier file.xml
en result.xhtml
.
<!--file.xml-->
<doc>
<para>Lorem ipsum dolor sit amet.</para>
<para>Consectetur adipiscing elit.</para>
<para>Nunc eu lectus in diam.</para>
</doc>
<!--result.xhtml-->
<xhtml>
<body>
<p><i>Lorem ipsum dolor sit amet.</i></p>
<p>Consectetur adipiscing elit.</p>
<p>Nunc eu lectus in diam.</p>
</body>
</xhtml>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="doc">
<xhtml>
<body>
<xsl:apply-templates select="para"/>
</body>
</xhtml>
</xsl:template>
<xsl:template match="para">
<p><xsl:value-of select="."/></p>
</xsl:template>
<xsl:template match="para[1]">
<p><i><xsl:value-of select="."/></i></p>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="doc">
<xhtml>
<body>
<xsl:apply-templates select="para"/>
</body>
</xhtml>
</xsl:template>
<xsl:template match="para">
<p><xsl:value-of select="."/></p>
</xsl:template>
<xsl:template match="para[1]">
<p><i><xsl:value-of select="."/></i></p>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="doc">
<xhtml>
<body>
<xsl:apply-templates select="para"/>
</body>
</xhtml>
</xsl:template>
<xsl:template match="para">
<p><xsl:value-of select="."/></p>
</xsl:template>
<xsl:template match="para[1]">
<p><i><xsl:value-of select="."/></i></p>
</xsl:template>
</xsl:stylesheet>