Elaborați un document XML, o schemă XML și o foaie de stil XML care să integreze informații despre vinul găsit într-un magazin de vinuri: identificarea vinului, crama, vechimea, stil, țara, regiunea, cost, preț, nivel de inventar și descriere.
Document XML
<wineStore
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:noNamespaceSchemaLocation='wine.xsd'>
<wine>
<wineID>1</wineID>
<winery>Ravenswood</winery>
<style>Zinfandel</style>
<vintage>2003</vintage>
<country>United States</country>
<region>Sonoma County, California</region>
<cost currency='USdollars'>12.50</cost>
<price currency='USdollars'>20.75</price>
<inventory>35</inventory>
<description>This 2003 Zinfandel has huge, jammy, inky, slightly porty aromas
infused with black pepper, vanilla and hints of tar, smoke and coffee blend.
A very broad, intense wine with huge fruit, lots of those luscious
Dry Creek bing cherry and sweet plum characters.</description>
</wine>
<wine>
<wineID>2</wineID>
<winery>Yalumba</winery>
<style>Shiraz</style>
<vintage>2001</vintage>
<country>Australia</country>
<region>Barossa Valley</region>
<cost currency='USdollars'>8.00</cost>
<price currency='USdollars'>15.95</price>
<inventory>17</inventory>
<description>The palate reveals velvety, ripe fine-grained tannins,
harmonising well with the oak and seductively spicy fruit.
The finish is rich and long, with cinnamon, cloves and brambly wild fruit note.</description>
</wine>
<wine>
<wineID>3</wineID>
<winery>Matariki</winery>
<style>Sauvignon Blanc</style>
<vintage>2004</vintage>
<country>New Zealand</country>
<region>Hawkes Bay</region>
<cost currency='USdollars'>7.50</cost>
<price currency='USdollars'>16.95</price>
<inventory>22</inventory>
<description>This wine shows ripe passionfruit and delicate tropical fruit aromas
and hints of gooseberry. Delicious fresh wine with a lovely balance of acid and
fruit sweetness. The finish is lively and lingering.</description>
</wine>
<wine>
<wineID>4</wineID>
<winery>Fonseca</winery>
<style>Port</style>
<vintage>2003</vintage>
<country>Portugal</country>
<region>Douro River</region>
<cost currency='USdollars'>70.00</cost>
<price currency='USdollars'>100.00</price>
<inventory>12</inventory>
<description>Ripe fruit, with chocolate, blackberries and raisins.
Full-bodied and medium sweet, with velvety tannins. Finish goes on and on.
Layered and wonderful.</description>
</wine>
<wine>
<wineID>5</wineID>
<winery>Louis Jadot</winery>
<style>Pinot Noir</style>
<vintage>1999</vintage>
<country>France</country>
<region>Burgandy</region>
<cost currency='USdollars'>37.50</cost>
<price currency='USdollars'>65.00</price>
<inventory>6</inventory>
<description>Concentrated aromas of ripe black berry and dark cherry fruit are offset by
suggestions of violet, minerals and tobacco in this ripe, velvety wine, and carry into a long,
silky finish underscored by firm tannins</description>
</wine>
</wineStore>
|
Schema XML
numele fișierului schemei: wine.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified"> <xsd:element name="wineStore"> <xsd:complexType> <xsd:sequence> <xsd:element name="wine" type="wineDescription" minOccurs = "1" maxOccurs="unbounded" /> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="wineDescription"> <xsd:sequence> <xsd:element name="wineID" type="xsd:integer" /> <xsd:element name="winery" type="xsd:string" /> <xsd:element name="style" type="xsd:string" /> <xsd:element name="vintage" type="xsd:integer" /> <xsd:element name="country" type="xsd:string" /> <xsd:element name="region" type="xsd:string" /> <xsd:element name="cost" type="xsd:decimal"> <xsd:complexType> <xsd:attribute name="currency" type="xsd:string" /> </xsd:complexType> </xsd:element> <xsd:element name="price" type="xsd:decimal"> <xsd:complexType> <xsd:attribute name="currency" type="xsd:string" /> </xsd:complexType> </xsd:element> <xsd:element name="price" type="xsd:decimal" /> <xsd:element name="inventory" type="xsd:integer" /> <xsd:element name="description" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:schema> |
Foaia de stil XML
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head>
<title>WINE STORE</title>
</head>
<body bgcolor="#4B0082">
<br /><center><H1><font face="algerian" color="#FFDAB9">WINE STORE</font></H1></center><br />
<xsl:apply-templates select="wineStore" />
</body>
</html>
</xsl:template>
<xsl:template match="wineStore">
<xsl:for-each select="wine">
<center>
<table bgcolor="#F08080" border="3" cellpadding="5" width="715px">
<tr>
<td width="100px" align="center"><font size="7"><xsl:value-of select="wineID" /></font></td>
<td width="350px"><font size="6"><xsl:value-of select="winery" /></font><br /><br />
<font size="4"><xsl:value-of select="country" />
<br />
<xsl:value-of select="region" /></font></td>
<td width="65px"><font size="6"><xsl:value-of select="vintage" /></font></td>
<td width="200px"><font size="6"><xsl:value-of select="style" /></font></td>
</tr>
<tr>
<td><font size="5"><xsl:text>Cost:</xsl:text><br />
<xsl:text>$ </xsl:text><xsl:value-of select="cost" /></font></td>
<td colspan="3" rowspan="2"><xsl:value-of select="description" /></td>
</tr>
<tr>
<td><font size="5"><xsl:text>Price:</xsl:text><br />
<xsl:text>$ </xsl:text><xsl:value-of select="price" /></font></td>
</tr>
</table>
</center>
<br /><br />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
|
Include texte traduse și adaptate din Wikibooks de Nicolae Sfetcu
Descoperă mai multe la MultiMedia
Abonează-te ca să primești ultimele articole prin email.




Lasă un răspuns