[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

solved: Re: adding space in xslt and trimming last spa

Subject: solved: Re: adding space in xslt and trimming last space injava-problem
From: remko de knikker <remko.deknikker@xxxxxxxx>
Date: Wed, 23 Jul 2003 12:02:35 -0400
space in xslt

This finally did it:


<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>

The web service I am calling
call.setTargetEndpointAddress( new java.net.URL("http://www.ebi.ac.uk:80/cgi-bin/xembl/XEMBL-SOAP.pl") );
call.setOperationName(new QName("http://www.ebi.ac.uk/XEMBL", "getNucSeq") );


does not allow for any other space format.

thanks all.






"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()"/>&#xa0;</xsl:for-each> > </xsl:template>


A number of observations:


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.

3. Your problem is artificial and it must be eliminated in your XSLT code --
no need to call an extension function.


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




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





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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.