[MarkLogic Dev General] text output
Michael Blakeley
michael.blakeley at marklogic.com
Thu Jan 22 11:33:17 PST 2009
On 2009-01-22 11:29, James A. Robinson wrote:
>
>> If a query returns text, it's text. You can set the content-type
>> response header, if that helps.
>>
>> xquery version "1.0-ml";
>>
>> "do we escape text output? 1< 2&& 2> 1"
>>
>> I have to escape '&' in the XQuery string, because of language
>> requirements. But I don't see any escaping in the output.
>
> Well gee, that's simple enough! Thank you for the answer, I guess
> I should have just experimented a bit more before asking! I had
> tried queries like:
>
> 'hi ',
> 'there'
>
> as an attempt to emulate XSLT like
>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="2.0">
> <xsl:output method="text" />
> <xsl:template match="/">hi
> there
> </xsl:template>
> </xsl:stylesheet>
>
> and had been confused by the output words being joined instead of
> appearing on separate lines, and thought I was trying the wrong
> approach.
I think you're using 3.2? IIRC, that's one difference between 3.2 and
4.0: in 4.0 those strings would automatically become separate lines.
With 3.2, you can generate multi-line output in any of at least three
ways: you can put newlines directly into strings (no escaping needed),
or use codepoints-to-string(), or wrap each string in a computed text
node: text { 'hi' }.
-- Mike
More information about the General
mailing list