how to get rid of some of the xml fields while displaying wi

hello,

i have attached xml and xslt file. Some of the fields are empty in XML file. i have xslt sheet which is retrieving all the data and displaying it. but as some of the fields are empty its printing blank lines. i want to get rid of those blank lines.

when i tried to display with IE it works fine with no blank lines but when i use netscape its giving me blank lines in between.

can anyone tell me how to remove those blank lines?

thanks in advance.

=====================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="event_portal.xsl"?>



<start_date_string>TUESDAY, NOVEMBER 23, 2004</start_date_string>


<event_id id=“60261” />
<start_time>10:00 a.m.</start_time>
<end_time>12:00 p.m.</end_time>
<e_type>Curriculum</e_type>
Gene Expression Course

<spkr_name></spkr_name>
<spkr_title></spkr_title>
<spkr_affl></spkr_affl>
<add_speak_title></add_speak_title>
<add_speak_info></add_speak_info>
<add3_speak_title></add3_speak_title>
<add3_speak_info></add3_speak_info>
<other_speak_info></other_speak_info>
<room_name>305 Weiss</room_name>



Open to RU/CUMC/NYPH/MSKCC community and guests only



<event_id id=“63717” />
<start_time>11:00 a.m.</start_time>
<end_time>12:00 p.m.</end_time>
<e_type>A Human Genetics Seminar</e_type>
Oxidative Stress, Cell Growth, and Carcinogenesis

<spkr_name>Konstantin Galaktionov</spkr_name>
<spkr_title>Assistant Professor</spkr_title>
<spkr_affl>Baylor College of Medicine</spkr_affl>
<add_speak_title></add_speak_title>
<add_speak_info></add_speak_info>
<add3_speak_title></add3_speak_title>
<add3_speak_info></add3_speak_info>
<other_speak_info></other_speak_info>
<room_name>301 Weiss</room_name>
Refreshments at 10:45 a.m.
Contact Chaowei Wu, (212) 327-7220

Open to RU/CUMC/NYPH/MSKCC community and guests only



===================================================================

then i am displaying this data using the xslt style sheet.

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
xmlns:xsl=“http://www.w3.org/1999/XSL/Transform”>
<xsl:template match=“calendar”>




<xsl:value-of select=“start_date_string”/>


<xsl:for-each select=“event”>



<xsl:value-of select=“start_time”/> - <xsl:value-of select=“end_time”/>
<xsl:value-of select=“e_type”/>
<xsl:value-of select=“title”/>
<xsl:value-of select=“subtitle”/>
<xsl:value-of select=“spkr_name”/>
<xsl:value-of select=“spkr_affl”/>
<xsl:value-of select=“add_speak_title”/>
<xsl:value-of select=“add_speak_info”/>
<xsl:value-of select=“add3_speak_title”/>
<xsl:value-of select=“add3_speak_info”/>
<xsl:value-of select=“other_speak_info”/>
<xsl:value-of select=“room_name”/>
<xsl:value-of select=“reception”/>
<xsl:value-of select=“contact”/>
<xsl:value-of select=“comments”/>
<xsl:value-of select=“audience”/>





</xsl:for-each>




</xsl:template>
</xsl:stylesheet>
=====================================================================

Probably the reason you?re seeing different results in IE and Netscape is that you?re not generating valid HTML. But you probably don?t want a lecture on web standards, you want to know how to only generate output for non-empty elements. Try something like this:

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version=“1.0"
xmlns:xsl=“http://www.w3.org/1999/XSL/Transform”>
<xsl:template match=“calendar”>




<xsl:value-of select=“start_date_string”/>


<xsl:for-each select=“event”>






xsl:apply-templates/

</xsl:for-each>




</xsl:template>

<xsl:template match=“start_time”>
<xsl:value-of select=”."/> - <xsl:value-of select="…/end_time"/>
</xsl:template>
<xsl:template match=“end_time”></xsl:template>

<xsl:template match=“e_type|subtitle|spkr_name|spkr_affl|add_speak_title
|add_speak_info|add3_speak_title|add3_speak_info
|other_speak_info|room_name|reception|comments|audience”>
<xsl:if test="./text()">
<xsl:value-of select="."/>
</xsl:if>
</xsl:template>

<xsl:template match=“title|contact”>
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>


If your source XML document completely left out the unused elements, instead of including them as empty elements, you could leave out the xsl:if element in the next to last template.

Hi

probably Netscape is even working correctly. You may replace e.g.
<xsl:value-of select=“add_speak_title”/>
by
<xsl:if test=“add_speak_title != ‘’”>
<xsl:value-of select=“add_speak_title”/>
</xsl:if>
in order to avoid generation of an empty .

Cheers
Uli


PS:
probably you should generate something like … instead of ….