Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 29th, 2008, 03:56 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 131
Thanks: 10
Thanked 0 Times in 0 Posts
Default Trailing blanks for 'text' output

Hi,

I need to output a XML file into 'text' layout using fixed length output fields. Whilst debugging in XMLSpy the trailing blanks are visible and the fields are correct widths, but if I select Transform within the application, the trailing blanks are reformated.

After surfing the net for a while, I found that a common solution appears to be the include 'indent' in the following statements:

Code:
<xsl:output method="text" indent="yes"/>
OR..
Code:
<xsl:output method="text" indent="no"/>
I've tried several variations on this statement including the 'omit-xml-declaration' and 'media-type="text/plain"' but the .html output always ignores my trailing blanks.

(I'm using xml version="1.0")

Can anyone advise please?

Thanks in advance.




Neal

A Northern Soul
__________________
Neal

A Northern Soul
 
Old May 29th, 2008, 05:02 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

The attributes indent, omit-xml-declaration, and media-type have no effect when using method="text".

If your stylesheet outputs spaces into the result tree, then they should appear in the serialized output. Of course, there are many text editors that will strip trailing whitespace before a newline, so it's quite possible that your output is being corrupted by a post-transformation process.

Where does ".html" fit into this?

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 29th, 2008, 05:29 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 131
Thanks: 10
Thanked 0 Times in 0 Posts
Default


'.html' is the extention I was using for the output file at the time. But the results are the same if I use the '.txt' extention (See 'Tools'/'Options'/'XSL' Tab in XMLSpy).

Neal

A Northern Soul
 
Old May 29th, 2008, 06:05 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>but if I select Transform within the application, the trailing blanks are reformated.

I don't know which application you are referring to here. Your own? If it works in XML Spy and not in environment X, then we need to know more about environment X.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 29th, 2008, 06:17 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 131
Thanks: 10
Thanked 0 Times in 0 Posts
Default

Transform is a function within XMLSpy (XSL Transform).

Believe me, I would have mentioned an additional application name if there was one.

As I mentioned in the first post, the trailing blanks are visible when debugging in XMLSpy. However, when selecting the 'Transform' function, the trailing blanks are reformatted.


Neal

A Northern Soul
 
Old May 29th, 2008, 06:25 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Then it sounds like a question for Altova.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
TEXT OUTPUT IN WINDOWS suman_16 XSLT 1 January 24th, 2008 06:09 AM
Output to text bonekrusher XSLT 4 November 25th, 2007 01:06 PM
XSL:output method="text" Pankaj C XSLT 4 August 2nd, 2007 10:05 AM
text output problems dextermagnific XSLT 1 August 10th, 2006 12:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.