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
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
basex-talk@mailman.uni-konstanz.de