Creating different types of output

Subject: Creating different types of output
From: Laurie Mann <laurie.mann@xxxxxxxxx>
Date: Mon, 19 Jun 2000 07:37:03 -0400
About two months ago, I converted one of my HTML sites
(Dead People Server - http://www.dpsinfo.com/index.shtml) to XML.
The XML source file is a long series of alphabetized records, 
each cluster of alphabetized records enclosed by a pair of "dpsletter" tags.
The alphabetic listings are created using a simple XSLT translation.

I would also like to create annual listings from the same source, 
and I didn't think it would be all that hard.  However, 
it seems to require more programming
skills than I have (which are close-to-none).

The source file has all the years coded in the XML file. When I run
my "build year" script, I get one HTML file for each year.  However, I
only get one record for each year, and that record is always the last
alphabetical listing for that year.  So what seems to be happening 
is that each time a new year is encountered, the year output file is
completely
overwritten, rather than the new record being appended to the
existing output file.

Is there an easy answer to this problem? 


XML file excerpt:

<set>
...
<dpsletter>
...

<dpsrecord><name><firstname>Don</firstname><lastname>Ameche</lastname></name
><job>actor</job><dead
value="yes"></dead><deathdate><month>Dec</month><day>6</day><year>1993</year
><birthdate><month>May</month><day>31</day><year>1908></year></birthdate><ot
her>Made a comeback in <movie>Cocoon</movie></other></dpsrecord>

....

<dpsrecord><ulink
url="http://cnnsi.com/tennis/features/1997/arthurashe/biography.html";><name>
<firstname>Arthur</firstname><lastname>Ashe</lastname></name></ulink><job>te
nnis great/writer</job><dead value="yes">
</dead><cause>AIDS</cause><deathdate><month>Feb</month><day>6</day><year>199
3</year></deathdate><birthdate><month>Jul</month><day>10</day><year>1943</ye
ar></birthdate><other>Broke the color barrier in men's tennis, wrote a very
moving memoir, <ulink
url="http://www.amazon.com/exec/obidos/ISBN=0345386817/awardwebcollectiA/";
value="amazon"><book>Days of Grace</book></other></dpsrecord>

...
</dpsletter>
...
</set>



XSL file excerpt:



<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:xt="http://www.jclark.com/xt"; version="1.0"
                extension-element-prefixes="xt">
<!-- XML structure and XSL script copyright 2000 Laurie D. T. Mann -->

<xsl:output method="html" indent="no"/>

<xsl:template match="set/dpsletter/dpsrecord">
<xsl:variable name="filename"><xsl:value-of
select="deathdate/year"/></xsl:variable>
  <xt:document href="{concat($filename,'.shtml')}">
<html><head><xsl:text>
     </xsl:text> 
       <title>Dead People Server - People Who Died in the Year
<xsl:value-of select="deathdate/year"/></title><xsl:text>
     </xsl:text> 
       <LINK REL="stylesheet" HREF="dps.css" TYPE="text/css" /><xsl:text>
     </xsl:text>
	</head>
	<body>
       <ul>
     <xsl:apply-templates/>
       </ul>       </body>
       </html>
  </xt:document>
</xsl:template>

........ 

</xsl:stylesheet>



HTML OUTPUT:


<html><head>
     <title>Dead People Server - People Who Died in the Year 1993</title>
     <LINK REL="stylesheet" HREF="dps.css" TYPE="text/css">
     </head><body><ul> <a
href="http://cnnsi.com/tennis/features/1997/arthurashe/biography.html";><span
class="name">Arthur  Ashe</span> </a> 
     (tennis great/writer) --  Dead.  AIDS.    Died Feb 6, 1993. 
     Born Jul 10, 1943. Broke the color barrier in men's tennis, wrote a
very moving memoir, <a
href="http://www.amazon.com/exec/obidos/ISBN=0345386817/awardwebcollectiA/";
class="am"><i>Days of Grace</i></a></ul></body></html>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread