Yeah, the xdmp:save gives you a serialized version to look at directly and check.
There's a little more on this here: https://help.marklogic.com/knowledgebase/article/View/328/0/xml-serialization-and-output-options /ch On Wed, Nov 8, 2017 at 11:31 AM, Mark Donoghue <[email protected]> wrote: > Christopher, thank you for responding :-) I was experimenting with your > suggestion (it worked) when Mary's response arrived. > > Mary, thank you for the information and workaround! > > It was surprising to find out the difference between writing back to the > database and serializing. I assumed it would be serialized everywhere. > > Best, > Mark > > - -- --- ----- -------- ------------- > Mark Donoghue > IEEE > (732) 562-6045 > [email protected] > > IEEE - Advancing Technology for Humanity > > On Wed, Nov 8, 2017 at 10:19 AM, Mary Holstege <[email protected]> > wrote: >> >> >> Character maps apply to serializations. What gets stored in the database >> isn't serialized: it is a data model instance, that isn't serialized >> unless it is (a) rendered as output from a query (b) saved to disk or (c) >> explicitly serialized as a string via xdmp:quote. >> >> There is a special pass-through that when a document is returned from XSLT >> and returned as a result of the query, the XSLT serialization options will >> be applied, but that only works within the context of a single query. >> >> Try this: force a serialization using xdmp:quote and saving the reparse of >> that, e.g. >> xdmp:document-insert("/my.xml", xdmp:unquote(xdmp:quote($doc)) ) >> >> I think that should work. Round-tripping a serialization/parse to/from >> disk should also work, e.g. >> xdmp:document-insert("/my.xml", xdmp:document-get("/tmp/my.xml", >> xdmp:save("/tmp/my.xml",$doc))) >> >> Failing that, you'll need to do a manual sweep-replace yourself so that >> the data model instance you save has the characters in it that you want. >> >> //Mary >> >> >> On Tue, 07 Nov 2017 15:22:41 -0800, Mark Donoghue <[email protected]> >> wrote: >> >> > Hi, >> > >> > >> > I am running a query in the query console that retrieves a document from >> > the >> > database, invokes an XSLT and stores the result over the same document >> > URI. >> > >> > >> > The purpose of the XSLT is to unescape double-escaped character entities >> > (i.e.: >> > &amp;). Following what I thought was standard practice, the XSLT >> > replaces &'s >> > with &xE0000; and uses a character map to swap the private character >> > with an >> > ampersand on output (using the use-character-maps on the xsl:output >> > element). >> > >> > >> > This works fine in oXygen and even in the query console tests where I >> > output the >> > result document to the output pane. >> > >> > >> > The problem occurs when I retrieve the document from the database. The >> > private >> > character &xE0000; is still in the result document I stored, and hasn't >> > been >> > replaced with an ampersand. >> > >> > >> > Does document-insert (or something) ignore the xsl:output directives in >> > the >> > stylesheet? >> > >> > >> > Am I running into some some query console behavior I'm not aware of (I'm >> > still >> > rather new at using MarkLogic). >> > >> > >> > Any pointers in the right direction will he much appreciated. >> > >> > >> > Best, >> > >> > Mark >> > >> > >> > - -- --- ----- -------- ------------- >> > Mark Donoghue >> > >> > IEEE >> > >> > (732) 562-6045 >> > >> > [email protected] >> > >> > >> > IEEE - Advancing Technology for Humanity >> >> >> -- >> Using Opera's revolutionary email client: http://www.opera.com/mail/ >> _______________________________________________ >> General mailing list >> [email protected] >> Manage your subscription at: >> http://developer.marklogic.com/mailman/listinfo/general > > > > _______________________________________________ > General mailing list > [email protected] > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
