xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hui Zhao" <hz...@globe.net.nz>
Subject Help for XML + XSL -> HTML
Date Fri, 19 Jan 2001 22:21:19 GMT
Hello,

I use James Clark's XSL processor xt to convert XML file into HTML format.
The HTML file I get is not what I expected, it doesn't show the content text
from the XML source, just print all the XSL stylesheet , someone can figure
it out for me, please.
Here is my XML source file:
*********************************************************
<?xml version="1.0"?>
<!--DOCTYPE sampleXML SYSTEM "sampleXML.dtd"-->
<sampleXML>
<!-- ++++ The header part of the document ++++ -->
<front>
<to>Mano</to>
<date>Next Friday Evening at 8 pm</date>
<where>The Web Cafe</where>
<why>My first XML sample</why>
</front>
<!-- +++++ The main part of the document +++++ -->
<body>
<par>
I would like to invite you all to celebrate
the birth of <emph>Invitation</emph>, my
first XML document child.
</par>
<par>
Please do your best to come and join me next Friday
evening. And, do not forget to bring your friends.
</par>
<par>
I <emph>really</emph> look forward to see you soon!
</par>
</body>
<!-- +++ The closing part of the document ++++ -->
<back>
<signature>Hui</signature>
</back>
</sampleXML>
**********************************************************

The following is XSL stylesheet:
**********************************************************
<?xml version='1.0'?>
<xsl:stylesheet
 xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
 xmlns="http://www.w3.org/TR/REC-html40"
 result-ns="">

<xsl:template match="sampleXML">
<html>
<head>
<title> My first XML (XSL/CSS formatting) </title>
</head>
<body>
<h1>My first XML sample </h1>
<table>
<tbody>
<tr><td class="front">To: </td>
<td><xsl:value-of select="@to"/></td></tr>
<tr><td class="front">When: </td>
<td><xsl:value-of select="@date"/></td></tr>
<tr><td class="front">Venue: </td>
<td><xsl:value-of select="@where"/></td></tr>
<tr><td class="front">Occasion: </td>
<td><xsl:value-of select="@why"/></td></tr>
</tbody>
</table>
<xsl:apply-templates/>
<p class="signature"><xsl:value-of select="@signature"/></p>
</body>
</html>
</xsl:template>

<xsl:template match="sampleXML/par">
<p><xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="sampleXML/par/emph">
<em><xsl:apply-templates/></em>
</xsl:template>

</xsl:stylesheet>
*******************************************************************
Here is the HTML file I get after the processing.
*****************************************************************
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet result-ns="" xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
xmlns="http://www.w3.org/TR/REC-html40"><xsl:template
match="sampleXML"><html><head><title> My first XML (XSL/CSS formatting)
</title><link href="invit.css" rel="stylesheet"
type="text/css"/></head><body><h1>My first XML sample
</h1><table><tbody><tr><td class="front">To: </td><td><xsl:value-of
select="@to"/></td></tr><tr><td class="front">When: </td><td><xsl:value-of
select="@date"/></td></tr><tr><td class="front">Venue:
</td><td><xsl:value-of select="@where"/></td></tr><tr><td
class="front">Occasion: </td><td><xsl:value-of
select="@why"/></td></tr></tbody></table><xsl:apply-templates/><p
class="signature"><xsl:value-of
select="@signature"/></p></body></html></xsl:template><xsl:template
match="sampleXML/par"><p><xsl:apply-templates/></p></xsl:template><xsl:templ
ate
match="sampleXML/par/emph"><em><xsl:apply-templates/></em></xsl:template></x
sl:stylesheet>


Thanks

Hui


Mime
View raw message