Subject: solved: [xsl] Re: adding space in xslt and trimming last space in java-problem From: remko de knikker <remko.deknikker@xxxxxxxx> Date: Wed, 23 Jul 2003 12:02:35 -0400 |
<xsl:template match="*"> <xsl:for-each select="//ns1:genbankid"> <xsl:value-of select="."/> <xsl:if test="not(position() = last())"> <xsl:text> </xsl:text> </xsl:if> </xsl:for-each> </xsl:template>
"remko de knikker" <remko.deknikker@xxxxxxxx> wrote in message news:3F15AE13.7040209@xxxxxxxxxxx > situation: > > I have an XML-file that contains a sequence of ids. I need to transform > this to a String of space separated ids. > So I transform the xml to a text file and after each id-node I add a > space, like this: > > <xsl:template match="*"> > <xsl:for-each select="//ns1:genbankid"> > <xsl:value-of select="text()"/> </xsl:for-each> > </xsl:template>
1. You have put inside a template matching every element code that does not depend on the current node. It may be executed several times and this is a mistake.
2. & # x a 0 ; without the intervening spaces is a character reference for the so-called "non-breaking space" -- it has nothing to do with the space character.
Add code, which tests if the position of the current node in the node-list is not the last -- only then output your whateverSpace character.
===== Cheers,
Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: adding space in xslt and , Dimitre Novatchev | Thread | [xsl] Is there a public xslt styles, Bill Riegel |
Re: [xsl] counting preceding siblin, David Carlisle | Date | RE: [xsl] counting preceding siblin, Kienle, Steven C [IT |
Month |