Reputation: 8550
This is my code:
let $directors := distinct-values(
for $director in //director
where count(result/videos/video[director = $director]) >= 2
return $director
)
for $director in $directors
return (
<movie director= " { data($director) } ">
{
for $movie in result/videos/video
where $movie/director = $director
return $movie/title
}</movie>)
)
And this is what it produces:
<?xml version="1.0" encoding="UTF-8"?>
<movie director=" Tokko ">
<title>Doquissåpan, avsnitt 1</title>
<title>Doquissåpan, avsnitt 2</title>
<title>Doquissåpan, avsnitt 4</title>
</movie>
But what I want is:
<?xml version="1.0" encoding="UTF-8"?>
<movie director=" Tokko ">
<title>Doquissåpan, avsnitt 1</title>
<title>Doquissåpan, avsnitt 2</title>
<title>Doquissåpan, avsnitt 4</title></movie>
The difference between these two is the ending movie-tag, if you didn't notice. How can I get it to be on the same line? Is there a way to stop XQuery from producing a new line?
Thx
Upvotes: 0
Views: 70
Reputation: 163262
I think that EditiX uses Saxon under the covers, though unlike other IDE vendors such as oXygen and Stylus Studio, they keep very quiet about it, and they have no commercial relationship with Saxonica. That means you will probably be able to use Saxon serialization directives in the query (e.g. "declare saxon:output indent='yes'" - unless EditiX has done something to prevent this. However, I don't think this is going to help you all that much. The output you are seeing is what you get if indentation is switched on. You seem to want output in which indentation is switched on for some elements, and off for others. If you need that level of control, you're going to have to switch indentation off completely and control the output of whitespace entirely "by hand" by including whitespace text nodes in the result of your query.
Upvotes: 1