XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
(Deleted User) Subject: Removing whitespace
Author: (Deleted User)
Date: 25 Jun 2007 02:23 PM
Originally Posted: 25 Jun 2007 02:15 PM
First, I am new user to Stylus Studio and somewhat new to XSLT.
I am using the Saxon 8.9.0.3 XSLT processor.

I am trying to convert this XML:
<Report xmlns="bwreport.es.service" delimiter="#">
<ColumnHeaders>
<Column>Period/Fiscal Year</Column>
<Column>Commitment</Column>
<Column>Obligation</Column>
</ColumnHeaders>
<Data>
<R>Period 00 2004# #</R>
<R>OCT 2004#$ 60,676,740.88#$ 60,658,920.88</R>
<R>NOV 2004#$ 52,446,486.16#$ 52,444,236.16</R>
<R>DEC 2004#$ 65,762,952.83#$ 65,762,952.83</R>
</Data>
</Report>

to this text output:
Period 00 2004# #
OCT 2004#$ 60,676,740.88#$ 60,658,920.88
NOV 2004#$ 52,446,486.16#$ 52,444,236.16
DEC 2004#$ 65,762,952.83#$ 65,762,952.83

I keep ending up with this as a result in the text file (also, the tabs don't seem to appear as presented but are there):
Period 00 2004# #
OCT 2004#$ 60,676,740.88#$ 60,658,920.88
NOV 2004#$ 52,446,486.16#$ 52,444,236.16
DEC 2004#$ 65,762,952.83#$ 65,762,952.83

I don't want the tabs in the output document.

My XSLT is:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bwreport="bwreport.es.service">
<xsl:output method="text" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/bwreport:Report/bwreport:Data/bwreport:R">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="."/>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="bwreport:ColumnHeaders"/>
</xsl:stylesheet>

I have read several XSLT documents on-line to no avail.

TIA

MTH

Postnext
(Deleted User) Subject: Removing whitespace
Author: (Deleted User)
Date: 26 Jun 2007 09:01 AM
Hi Michael,
as the tabs are not displayed in your message, it's hard to understand what is not working; could you attach the files instead of copying them?

Thanks,
Alberto

Postnext
(Deleted User) Subject: Removing whitespace
Author: (Deleted User)
Date: 26 Jun 2007 09:22 AM
The files are attached.

The file with the original xml is called report.xml. The output file is called bw_report_output.txt.

Thanks.

Postnext
(Deleted User) Subject: Removing whitespace
Author: (Deleted User)
Date: 26 Jun 2007 09:23 AM
The files are attached.

The file with the original xml is called report.xml. The output file is called bw_report_output.txt.

Thanks.


Unknownbw_report_output.txt
Output file

Postnext
(Deleted User) Subject: Removing whitespace
Author: (Deleted User)
Date: 26 Jun 2007 09:24 AM
Sorry, first time uploading files. Here is the other one.


Documentbw_report_output.xsl
XSLT

Unknownreport(3).xml
input xml document

Posttop
(Deleted User) Subject: Removing whitespace
Author: (Deleted User)
Date: 26 Jun 2007 09:39 AM
Hi Michael,
the tab that is generated before each row is defined inside the xsl:text you wrote in the stylesheet.
You have

(TAB)<xsl:text>(CR)(LF)
(TAB)</xsl:text>

and this will write a new line followed by a tab after each row. If oyu change it to be

(TAB)<xsl:text>(CR)(LF)
</xsl:text>

you should get what you are expecting.

Hope this helps,
Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.