I am trying to create a simple xml. This is the way I want to display my info in html:
Proeverij 272
Prinsengracht 272, Jordaan, Amsterdam
Dutch/International
pin
I have a DTD, a XML and a XSLT but somehow it doesn't display all the info (the address info) I want.
Many thanx in advance,
hbthang
My DTD:
<!DOCTYPE guide [
<!ELEMENT guide (restaurant)>
<!ELEMENT restaurant (name,address,kitchen,payment)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT address (address, area?, city)>
<!ELEMENT area (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT kitchen (#PCDATA)>
<!ELEMENT payment (#PCDATA)>
<!ATTLIST address str_name CDATA #REQUIRED>
<!ATTLIST address str_number CDATA #REQUIRED>
]>
A piece of my XML:
<guide>
<restaurant>
<name>Proeverij 274</name>
<address str_name="Prinsengracht" str_number="274" area="Jordaan" city="Amsterdam" />
<kitchen>Dutch/International</kitchen>
<payment>visa, mastercard, pin</payment>
</restaurant>
...
</guide>
My XSLT:
?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="/">
<html>
<body style="font-family:Arial,helvetica,sans-serif;font-size:12pt">
<h2>My Restaurants Guide</h2>
<xsl:for-each select="guide/restaurant">
<xsl:value-of select="name" />
<p />
</xsl:for-each>
<xsl:for-each select="guide/restaurant/address">
<xsl:value-of select="str_name" />
<xsl:value-of select="str_number" />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>