Hi Lars Johnsen,
declare the output to be HTML using the [serialization options], for example add these lines to the XQuery prolog:
declare option output:method "html";
declare option output:html-version "5.0"; (: not required, will add XML declaration :)
Doing so, BaseX will not shorten empty tags any more.
Kind regards,
Jens Erat
[serialization options]: http://docs.basex.org/wiki/Serialization
--
Jens Erat
[phone]: tel:+49-151-56961126
[mail]: mailto:email@jenserat.de
[jabber]: xmpp:jabber@jenserat.de
[web]:
http://www.jenserat.de
PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B
Am 24.09.2013 um 17:28 schrieb Lars Johnsen
yoonsen@gmail.com:
> Hello BaseX developers!
>
> When using BaseX scripting to generate HTML, I got a problem with the representation of empty nodes. For example, my code has something like this in it
>
> <div> { ... some code...} </div>
>
> if ...some code... returns nothing, the div is empty as is labelled <div/>. This causes trouble in HTML, since <div/> is treated as if it was the start tag <div>, and will therefore nest over following divs. Is there a way for BaseX to output <div></div> instead?
>
> There is an ad hoc solution which checks if ...some code... is empty and inserts a blank in those cases, preventing the div from collapsing into one tag, but was hoping for a more general solution.
>
>
> All the best,
>
> Lars G Johnsen
> National Library of Norway
> _______________________________________________
> BaseX-Talk mailing list
> BaseX-Talk@mailman.uni-konstanz.de
>
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk