[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

[Newbie] Output contains space around each value -- how do I delete the space?

Costello, Roger L. costello at mitre.org
Sat Apr 3 10:05:47 PST 2010

  [Newbie] Output contains space around each value --
 how do I delete the space?
Hi Folks,

I have an XQuery that extracts all the data in a bookstore XML document and formats the output as slash-delimited values. Here's my XQuery:

declare namespace saxon = "http://saxon.sf.net/";
declare option saxon:output "indent=no";
declare option saxon:output "method=text";

let $source := doc("bookstore.xml")

      for $i in $source//book return

The XQuery does almost exactly what I desire. However, there is a space around each value. Here's the output:

The ABC Book Store 
 The Origin of Wealth / Eric D. Beinhocker / 2006 / 1-57851-777-X / Harvard Business School Press / 29.95 
 DOM Scripting / Jeremy Keith / 2005 / 1-59059-533-5 / friends of ed / 34.99 
 Guns, Germs, and Steel / Jared Diamond / 2005 / 0-393-06131-0 / W. W. Norton & Company, Ltd. / 24.99 
 Economics in One Lesson / Henry Hazlitt / 1946 / 0-517-54823-2 / Three Rivers Press / 11.00 
 How to Read a Book / Mortimer J. Adler / 1940 / 0-671-21280-x / Simon & Schuster, Inc. / 15.00 
 Don't Make Me Think / Steve Krug / 2006 / 0-321-34475-8 / New Riders / 40.00 
 Bulletproof Ajax / Jeremy Keith / 2007 / 0-321-47266-7 / New Riders / 34.99

Why am I getting spaces around each value?

How do I delete those spaces?

Here's the input XML document:

<?xml version="1.0"?>
<bookstore storename="The ABC Book Store">
        <title>The Origin of Wealth</title>
        <author>Eric D. Beinhocker</author>
        <publisher>Harvard Business School Press</publisher>
        <cost currency="USD">29.95</cost>
        <title>DOM Scripting</title>
        <author>Jeremy Keith</author>
        <publisher>friends of ed</publisher>
        <cost currency="USD">34.99</cost>
        <title>Guns, Germs, and Steel</title>
        <author>Jared Diamond</author>
        <publisher>W. W. Norton &amp; Company, Ltd.</publisher>
        <cost currency="USD">24.99</cost>
        <cost currency="CAD">31.00</cost>
        <title>Economics in One Lesson</title>
        <author>Henry Hazlitt</author>
        <publisher>Three Rivers Press</publisher>
        <cost currency="USD">11.00</cost>
        <cost currency="CAD">17.00</cost>
        <title>How to Read a Book</title>
        <author>Mortimer J. Adler</author>
        <author>Charles Van Doren</author>
        <publisher>Simon &amp; Schuster, Inc.</publisher>
        <cost currency="USD">15.00</cost>
        <cost currency="CAD">23.00</cost>
        <title>Don't Make Me Think</title>
        <author>Steve Krug</author>
        <publisher>New Riders</publisher>
        <cost currency="USD">40.00</cost>
        <cost currency="CAD">44.00</cost>
        <cost currency="GPB">28.99</cost>
        <title>Bulletproof Ajax</title>
        <author>Jeremy Keith</author>
        <publisher>New Riders</publisher>
        <cost currency="USD">34.99</cost>
        <cost currency="CAD">43.99</cost>
        <cost currency="GPB">24.99</cost>



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.
First Name
Last Name
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.