My follow-up was too hasty, and I forgot to mention that I had tried starting 
up basex with -w, but it break so many other things that I cannot use this 
GLOBAL approach.
I need to instruct either at the XQUERY command level or at the xml file level.
By the way, Kirstian, THANK YOU does work in the simplified data I gave for my 
original post. Unfortunately your solution does not work in more complicated 
examples of my datt. If you’re interested in what the real data looks like and 
the continuing issue, please hit me off-list.

Thanks gentlemen!
Mark

> On Feb 26, 2019, at 07:16, Mark Bordelon <markcborde...@yahoo.com> wrote:
> 
> Thanks Martin and Michael for the “sofortige Antoworten”.
> Forgive my lack of understanding about the particular of whitespace 
> processing and how BASEX deals with them.
> To answer Martin’s questions:
> 1) I stored that xml (as I do all of my email) in the database using this 
> commands in the basex shell:
> ADD TO PROSE.test test.xml
> after I created the file in vi on my desktop.
> I had no xml preamble or any processing instructions about the whitespace.
> 2) I am also querying in the basex using XQUERY.
> 
> In short,I need to get the result with the actual text node after the element 
> I target, even if it is null, not the next element’s non-null text.
> 
> Given my storage, is adjusting the XPATH the way Kristian suggested the best 
> way to achieve my goal?
> Concretely, how can I adjust how XQUERY executes the path directly to deal 
> with the whitespace issue? I cannot use parse-xml(). Do I add the -w option 
> to the XQUERY that I call from the basex client?
> And concretely, how can I store the XML with preamble or processing 
> instruction about whitespace to achieve my result?
> 
>> On Feb 26, 2019, at 05:50, Michael Seiferle <m...@basex.org 
>> <mailto:m...@basex.org>> wrote:
>> 
>> Hi Mark, 
>> Hi Martin,
>> 
>> yes Martin is right, the whitespace will be chopped by default leading to 
>> the observed behavior.
>> 
>> If you wanted to preserve whitespace globally, you can do that when creating 
>> your database. 
>> If you only want to preserve whitespace for a given element you may do this 
>> as well:
>> 
>>> let $db := 
>>> '<text id="test">
>>>   <clause xml:space="preserve">
>>>     <word>A</word>a
>>>     <word>B</word>
>>>     <word>C</word>c
>>>   </clause>
>>> </text>' => parse-xml() (: have to actually parse it for the whitespace 
>>> preserve to have a an effect :)
>>> 
>>> return $db//word/concat(text(), ' ', 
>>> normalize-space(./following-sibling::text()[1]))
>> 
>> Which returns: 
>>> A a
>>> B 
>>> C c
>> 
>> 
>> Best
>> Michael
>> 
>>> 
>>> Am 26.02.2019 um 09:48 schrieb Martin Honnen <martin.hon...@gmx.de 
>>> <mailto:martin.hon...@gmx.de>>:
>>> 
>>> 
>>> I think the result you get is caused by whitespace chopping during XML 
>>> parsing, seems to be the default, 
>>> seehttp://docs.basex.org/wiki/Command-Line_Options 
>>> <http://docs.basex.org/wiki/Command-Line_Options>
>>> -w  Toggles whitespace chopping of XML text nodes. By default, whitespaces 
>>> will be chopped.
>>> 
>>> 
>>> 
>> 
> 

Reply via email to