One possibility is to not pick up the comma in the first place and then
place a new comma (and space) where you want it, thus:
<xsl:template match="field">
<xsl:for-each select="descriptiveWord">
<xsl:apply-templates select="."/>
<xsl:if test="not(position() = last())"><xsl:text>,
</xsl:text></xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="descriptiveWord">
<xsl:value-of select="normalize-space(.)"/>
</xsl:template>
Note that I added the normalize-space function to the descriptiveWord
template because the contents of those nodes have leading and trailing
spaces, which would also mess with your punctuation. Hence the space after
the comma within xsl:text.
I'm sure there are other ways, but this one works (just tested it with
Saxon 8).
HTH
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
"Peter Charles" <petefc(_at_)SIMS(_dot_)Berkeley(_dot_)EDU>
03/16/2005 12:14 PM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
cc
Subject
Spam:[xsl] removing space in a text node
Hello,
If I have the following structure:
<field name="c14alias" displayName="Created By">
<descriptiveWord> Malina </descriptiveWord> ,
<descriptiveWord> Mark </descriptiveWord>
</field>
Is there an easy way to remove the leading space from in front of the
comma
that sits between the descriptiveWord nodes?
Thanks
Peter
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--