Hi Paul,
The typical way I have seen folks deal with this is to dynamically transform the content to html. A handy way to do this is with a recursive typeswitch. You could, for example, have a function for each element you are transforming. Here is a simple transformation example (from the Developer's Guide, chapter 13, "Transforming XML Structures with a Recursive typeswitch Expression", page 111): default element namespace="http://www.w3.org/1999/xhtml" (: This function takes the children of the node and passes them back into the typeswitch function. :) define function passthru($x as node()) as node()* { for $z in $x/node() return dispatch($z) } (: This is the recursive typeswitch function :) define function dispatch($x as node()) as node()* { typeswitch ($x) case text() return $x case element (a) return passthru($x) case element (title) return <h1>{passthru($x)}</h1> case element (para) return <p>{passthru($x)}</p> case element (sectionTitle) return <h2>{passthru($x)}</h2> case element (numbered) return <ol>{passthru($x)}</ol> case element (number) return <li>{passthru($x)}</li> default return <tempnode>{passthru($x)}</tempnode> } let $x := <a> <title>This is a Title</title> <para>Some words are here.</para> <sectionTitle>A Section</sectionTitle> <para>This is a numbered list.</para> <numbered> <number>Install MarkLogic Server.</number> <number>Load content.</number> <number>Run very big and fast XQuery.</number> </numbered> </a> return <html xmlns="http://www.w3.org/1999/xhtml"> <head><title>MarkLogic Sample Code</title></head> <body>{dispatch($x)}</body> </html> For a slightly more complex example, see the Shakespeare Sample app (the app is available here: http://developer.marklogic.com/code/, and here is a link to the display library for it: http://xqzone.marklogic.com/svn/bill/trunk/display-lib.xqy). -Danny From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul M Sent: Friday, March 14, 2008 8:47 AM To: [email protected] Subject: [MarkLogic Dev General] Caveats content text/html To All: <body><p><abstract>hello<clientname>george</clientname> how are you today?</abstract></p></body> The abstract element was retrieved from document within ML database. Obviously, <abstract> and <clientname> are not valid HTML. As such, they will/should be ignored. I have not seen this to be a problem yet within the browsers tested. Though I understand that this is NOT valid HTML, do others also fall into this trap? Have you experienced any web browser issues? How do you handle this if the element you retrieve(//abstract) has numerous child elements all of which are to be displayed in order(i.e. parent node/parent text /child node/child text/parent text/child2 node/ child? ________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. <http://us.rd.yahoo.com/evt=51734/*http:/tools.search.yahoo.com/newsearc h/category.php?category=shopping>
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
