So, I'm pretty new to XML. I'm following the tutorial on
http://ils.unc.edu/~sedac/inls259/DTD.html and also using
http://www.w3schools.com/dtd/dtd_intro.asp because the explanation is simpler. I can replicate the XML example on the first link by copying the DTD, XSL and XML files onto my web space, but I can't seem to change the tags to get it to work with what I'm doing. I'm trying to start out with a simple one-tier structure -
release being the root element and
date and
headline being the other elements.
Here is my releases.dtd file:
Code:
<!ELEMENT release (date,headline)>
<!ELEMENT date (#PCDATA)>
<!ATTLIST date e-dtype NMTOKEN #FIXED 'string'>
<!ELEMENT headline (#PCDATA)>
<!ATTLIST headline e-dtype NMTOKEN #FIXED 'string'>
output.xsl:
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<title>untitled</title>
</head>
<body bgcolor="#8FACC7" text="#ffffff" link="#808040">
<xsl:for-each select="date">
<p class='releases'>
<xsl:value-of select="date"/>
</p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
and output.xml:
Code:
<?xmlversion ="1.0"?>
<?DOCTYPE release SYSTEM "releases.dtd"?>
<?xml-stylesheet href="output.xsl" type="text/xsl"?>
<release>
<date>JULY 10, 1994</date>
<headline>TEST HEAD</headline>
</release>
The output.xml displays a blank page with bgcolor color specified in the xsl stylesheet, so I think that's fine. I'm just having trouble grasping how to write the DTD, so I suspect that's my main problem. What could I be doing wrong? Thanks for any help.
