[MarkLogic Dev General] Quirks of generating xhtml with xquery

Eric Palmitesta eric.palmitesta at utoronto.ca
Wed Aug 27 14:53:52 PDT 2008


Aaron and I discussed this briefly at the training seminar, but I'd like 
to get a sense of what other developers are doing to get around the 
quirks of generating xhtml with xquery (rather than a java servlet/jsp 
based website which pulls records from MarkLogic via XDBC/XCC.

One such quirk: Childless elements with no internal nodes and an 
explicit closing tag are automatically folded into elements with no 
closing tag.  <div></div>, which is valid xhtml, will become <div /> 
after being processed by MarkLogic (breaks visual representation).  Some 
better examples are <script ...></script> and <textarea></textarea>, 
which are expected to contain no internal nodes in xhtml.

I've taken to writing things like

<script ... >{" "}</script>

or

<textarea>&nbsp;</textarea>

which successfully preserves the explicit closing tag, keeping xhtml 
happy.  Is there a more elegant way to do this?

Are there other banana-peels I should watch out for when generating 
xhtml with xquery?  Is creating an entire website by generating xhtml 
with xquery generally frowned upon, or accepted?  Admittedly, it seems 
less flexible than a <web language>-based site, however the xdmp 
namespace seems to provide sufficient functionality, and transforming 
xml data into xhtml is incredibly easy with xquery.

Cheers,

Eric


PS
My vocabulary might be incorrect regarding words like 'tag' and 'node', 
please correct me if necessary.

PPS
I can see the archives at http://xqzone.marklogic.com/pipermail/general/ 
but are they searchable?  I have a feeling newcomers such as myself will 
be prone to asking questions which have already been discussed at length.


More information about the General mailing list