Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 17th, 2009, 03:03 PM
Authorized User
 
Join Date: Jan 2008
Location: Austin, TX, USA.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dved Send a message via Yahoo to dved
Default How to remove extra space from PSV

I m trying to return a psv file ...and so my output is "text" in this case.

Here is my code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:strip-space elements="*"/>
<xsl:template match="paymentHistoryList">
<xsl:apply-templates></xsl:apply-templates>
</xsl:template>
<xsl:template match="paymentHistoryList">
<xsl:for-each select="paymentHistoryInfo[1]//*">
<xsl:value-of select="local-name()"/>|
</xsl:for-each>
&NL;
<xsl:for-each select="paymentHistoryInfo//*">
<xsl:value-of select="current()/text()"/>|
</xsl:for-each>
&NL;
</xsl:template>

</xsl:stylesheet>

it outputs additional new lines like under:

invoiceDate|
invoiceNumber|
previousBalance|
paymentsRecieved|
balanceForward|
currentCharges|
totalBalance|

200803|
1404813176|
135.04|
135.04|
0.0|
69.38|
69.38|
200209|
384519202|
0.0|
0.0|
0.0|
97.71|
97.71|


I want it like:
invoiceDate|invoiceNumber|previousBalance|payments Recieved|balanceForward|currentCharges|totalBalanc e|
1404813176|135.04|135.04|0.0| 69.38|...


can you help ??
__________________
Thanks
Dved
Reply With Quote
  #2 (permalink)  
Old February 17th, 2009, 06:19 PM
mhkay's Avatar
Wrox Author
Points: 18,438, Level: 59
Points: 18,438, Level: 59 Points: 18,438, Level: 59 Points: 18,438, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,954
Thanks: 0
Thanked 290 Times in 285 Posts
Default

The pipe character in the stylesheet is followed by a newline, so both have been copied to the output.

It's best to use <xsl:text>|</xsl:text> to output literal text, it gives you much better control over whitespace. That also applies to

<xsl:text>&NL;</xsl:text>
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Reply With Quote
  #3 (permalink)  
Old February 18th, 2009, 10:52 AM
Authorized User
 
Join Date: Jan 2008
Location: Austin, TX, USA.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dved Send a message via Yahoo to dved
Default

Thanks..that worked for me..

Quote:
Originally Posted by mhkay View Post
The pipe character in the stylesheet is followed by a newline, so both have been copied to the output.

It's best to use <xsl:text>|</xsl:text> to output literal text, it gives you much better control over whitespace. That also applies to

<xsl:text>&NL;</xsl:text>
__________________
Thanks
Dved
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
extra space??? crazeydazey XSLT 2 August 11th, 2008 05:55 AM
nested <div> creates extra space sstuber BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 May 2nd, 2008 09:56 AM
remove commas and space in a string kumiko Classic ASP Basics 1 January 10th, 2008 11:42 PM
Stripping out extra space around an italic word simone_s XSLT 2 April 25th, 2006 03:50 AM
Remove Space from table records mateenmohd SQL Server 2000 1 July 20th, 2003 06:55 AM



All times are GMT -4. The time now is 10:46 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.