The normalize-space() function appears to be having problems with
xalan-j_2_3_0 when the output method is text. This XML file:

==================================
<?xml version="1.0" encoding="UTF-8"?>
<club-database>
<association id="BAWA">
<club id="Q18" charter="2000">
        <name>Benicia USA Wrestling Club</name>
        <contact>Tim Bergman</contact>
        <location>Benicia</location>
        <phone>707-555-1212 (h)</phone>
        <age-groups type="KCJOW"/>
        <info>Practice sessions are Tuesdays and Thursdays from 6:00 - 7:30 p.m. in 
the cafeteria of Benicia High School.  Cost for joining is $25.00 and that goes 
towards a USA Wrestling card.</info>
</club>
</association>
</club-database>
==================================

When run through the following XSLT file, Xalan produces incorrect output.
The XSLT file gets rid of text nodes that are between newlines in
the original XML. It normalizes space for text within an <info>
element because the output file must have only one line per
club.

==================================
<?xml version="1.0"?>
<xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
>

<xsl:output method="text"/>

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

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

<xsl:template match="club">
        <xsl:value-of select="../@id"/><xsl:text>|</xsl:text>
        <xsl:value-of select="name"/><xsl:text>|</xsl:text>

        <xsl:apply-templates select="info"/>
<xsl:text>
</xsl:text>
</xsl:template> 

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

<xsl:template match="info/text()">
        <xsl:value-of select="normalize-space(.)"/>
</xsl:template>

<xsl:template match="text()"/>

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

Here is the incorrect output (there should be a space after
6:00 PM and between the words "of" and "Benicia").  

=====================================================
BAWA|Benicia USA Wrestling Club|Practice sessions are Tuesdays and Thursdays from 
6:00- 7:30 p.m. in the cafeteria ofBenicia High School. Cost for joining is $25.00 and 
that goes towards a USA Wrestling card.
======================================================

Note: the output was correct on Xalan 1.0

-- 
J. David Eisenberg  http://catcode.com/

Reply via email to