| From | Sent On | Attachments |
|---|---|---|
| Jonathan Cook - FM&T | Feb 21, 2012 2:56 am | |
| Geert Josten | Feb 21, 2012 3:47 am | |
| Michael Blakeley | Feb 21, 2012 10:19 am | |
| Betty Harvey | Feb 21, 2012 4:14 pm | |
| David Lee | Feb 21, 2012 4:45 pm | |
| Michael Blakeley | Feb 21, 2012 4:58 pm | |
| Betty Harvey | Feb 21, 2012 5:43 pm | |
| David Lee | Feb 21, 2012 6:17 pm | |
| Geert Josten | Feb 25, 2012 11:53 am |
| Subject: | Re: [MarkLogic Dev General] Passing Character Entities to Output | |
|---|---|---|
| From: | Geert Josten (geer...@dayon.nl) | |
| Date: | Feb 25, 2012 11:53:50 am | |
| List: | com.marklogic.developer.general | |
Hi Betty,
Your thread caught my attention earlier, but failed to look into in before. There are a few ways out I guess, but they might not be very elegant..
One option is to xdmp:quote the XML, and do a blunt replace of ' ' with '
'. Upon serialization by the App Server, all line ends will come out as ' '. But this replaces line ends before the root element as well.
A slightly more elegant way is to use xsl character maps. Something like this:
let $xsl := <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:character-map name="escape-line-end"> <xsl:output-character character=" " string="&#10;"/> </xsl:character-map> <xsl:output use-character-maps="escape-line-end" /> <xsl:template match="/"> <xsl:copy-of select="/"/> </xsl:template> </xsl:stylesheet> return xdmp:xslt-eval($xsl, document { <test> <test> </test> </test> } )
Kind regards, Geert
-----Oorspronkelijk bericht----- Van: gene...@developer.marklogic.com [mailto:general- boun...@developer.marklogic.com] Namens Betty Harvey Verzonden: woensdag 22 februari 2012 3:10 Aan: MarkLogic Developer Discussion Onderwerp: Re: [MarkLogic Dev General] Passing Character Entities to Output
Thanks Mike:
I am afraid that won't work. The application is Microsoft Excel. I need linefeeds in a specific Cell to give a list values on individual lines in a single cell. Microsoft sees the binary line feed as just whitespace and treats it as whitespace and not a real linefeed. In order to get a linefeed into Excel in importing Excel 2003 XML the character entity is required.
I guess I am stuck with either (1) having the text wrap which is really messy looking; or (2) post processing the resulting XML file.
Thanks!
Betty
Technically there is no difference: *means* codepoint 10 to any XML processor. A tool that only works when reading one or the other is broken.
But you can configure your app server and set the "output sgml character entities" to "normal" - or anything other than "none". Then you should see this:
<cell> <data>hello
big
world</data> </cell>
I don't know if that's any better for your purposes, but at least it isn't the literal codepoint.
-- Mike
On 21 Feb 2012, at 16:41 , Betty Harvey wrote:
I asked this question on the XQuery list and it looks like this can't be done in straight XQuery. I am asking this question here just in case there is a MarkLogic function that can be used.
I need to pass a linefeed character to the output. I am creating Excel spreadsheets where I need a list on separate lines in a single cell. Excel recognizes the character entity for linefeeds.
My output needs to look like this:
<cell><data>hello big world</data></cell>
The output I am getting is:
<cell><data>hello big world</data></cell>
I have tried several variations of:
let $newline := " " let $newline := fn:concat("&", "#10;")
etc. All having the same results, getting a linefeed instead of placing the actual character entity in the output.
Are there any MarkLogic tricks to passing a character entity through without serializing it?
TIA!
Betty
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ Betty Harvey | Phone: 410-787-9200 FAX: 9830 Electronic Commerce Connection, Inc. | har...@eccnet.com | Washington,DC XML Users Grp URL: http://www.eccnet.com | http://www.eccnet.com/xmlug /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/ Member of XML Guild (www.xmlguild.org)
_______________________________________________ General mailing list Gene...@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list Gene...@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ Betty Harvey | Phone: 410-787-9200 FAX: 9830 Electronic Commerce Connection, Inc. | har...@eccnet.com | Washington,DC XML Users Grp URL: http://www.eccnet.com | http://www.eccnet.com/xmlug /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/ Member of XML Guild (www.xmlguild.org)
_______________________________________________ General mailing list Gene...@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list Gene...@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general





