I don't think anyone else has mentioned it, but if you're generating
a full HTML page via MarkLogic Server, you can use the xdmp:tidy()
function to clean up your generated XHTML and control doctype:

  http://xqzone.com/pubs/3.2/apidocs/Document-Conversion.html#tidy

xmdp:tidy() takes a string argument, however, so you need to wrap your
HTML inside xdmp:quote():

  xdmp:tidy(xdmp:quote($my_html_node))


On Wed, 27 Aug 2008, Eric Palmitesta wrote:

> 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.
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>

-- 
David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 801079, Charlottesville, VA 22904-4318 USA
Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
Email: [EMAIL PROTECTED]   Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to