[thelist] Xsl for each problems

fstorr fffrancis at fstorr.demon.co.uk
Wed Nov 20 13:59:00 CST 2002


I'll try again, and this time try not to hit the wrong key........

Hi all

I'm struggling somewhat with some XSL.  This is the first time I've
really looked at this area and I can't seem to work out exatly what I'm
doing wrong.  I'm trying to use an XSL for each command to create an
unordered list from a <title> element in my XML file.  All I get is one
lonely bullet point and nothing else!  I've used the working draft
doctype as I need this to work in IE5.

The XML:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="tester1.xsl" ?>

<CSID>
<IssueDate>18th November 2002</IssueDate>
<story>
<title>Christmas Party</title>
<summary>Dress code for the event</summary>
</story>

<story type="current">
<title>NXL screen</title>
<summary>Use this screen</summary>
</story>

</CSID>


The XSL

<xsl:stylesheet xmlns:xsl="http://www.w3org/TR/WD-xsl">

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

<xsl:template match="story">
<html>
<head>
<style type="text/css">
body{
background-color:blue;
color:white;
font:10px verdana;
}
</style>
</head>
<body>
<h1>CSID page</h1>
<ul>
<xsl:for-each select="title">
<li>
<xsl:value-of select="text()" />
</li>
</xsl:for-each>
</ul>

</body>
</html>

</xsl:template>

</xsl:stylesheet>

Help!

Regards

Francis





More information about the thelist mailing list