Forum Moderators: open
<!ELEMENT journal (entry+)>
<!ELEMENT entry (date,text)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT text (#PCDATA)> journal.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="journal.xsl"?>
<!DOCTYPE journal SYSTEM "journal.dtd">
<journal>
<entry>
<date>03/31/2007</date>
<text>entry with [b]<b>bold</b>[/b] word</text>
</entry>
</journal> journal.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head><title>XSLT Test</title></head>
<body>
<xsl:for-each select="journal/entry">
<em><xsl:value-of select="date" /></em><br />
<xsl:value-of select="text" />
<hr />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:transform> As you can see from this test, wrapping the entire element (in the XSL file) with EM tags formats that entire element as italics. However the <b> tags within the TEXT element are not acted on by the browser ... it just ignores them. I've tried including the B tag in various places within the DTD with no luck.
Am I correct in that a < character is illegal within an element's content, anyway?
I'm trying to discover if I can use XML files for storing this type of data with modest formatting, or if I should continue to use the HTML files I've been using.
Thank you in advance for any thoughts on this.
Gotta run.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head><title>XSLT Test</title></head>
<body>
<xsl:for-each select="journal/entry">
<em><xsl:value-of select="date" disable-output-escaping="yes" /></em><br />
<xsl:apply-templates/>
<hr />
</xsl:for-each>
</body>
</html>
</xsl:template><xsl:template match="text">
<em><xsl:apply-templates/></em>
</xsl:template><xsl:template match="b">
<b><xsl:apply-templates/></b>
</xsl:template>
</xsl:transform>