1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| <?xml version="1.0" encoding="iso-8859-1"?>
<?xml:stylesheet type="text/xsl" href="books.xsl"?>
<books>
<book>
<title>Dilbert</title>
<author>Scott Adams</author>
<price>13</price>
</book>
<book>
<title>Le seigneur des anneaux</title>
<author>J.R.R Tolkien</author>
<price>12.50</price>
</book>
<book>
<title>Harry Potter à l'ecole des sorciers</title>
<author>J.K. Rowling</author>
<price>8.54</price>
</book>
<book>
<title>les misérables</title>
<author>Victor Higo</author>
<price>7.50</price>
</book>
</books>
avec son fichier xsl suivant :
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="books/book">
<xsl:text> INSERT INTO books (title, author, price) VALUES ( </xsl:text>
<xsl:value-of select="title"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="author"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="price"/>
<xsl:text> </xsl:text>
<xsl:text>);</xsl:text><br/>
</xsl:template>
</xsl:stylesheet> |
Partager