Funny, back when I learned the language, fn:concat() only accepted xs:string 
parameters:

http://www.w3.org/TR/2003/WD-xpath-functions-20030502/#func-concat

Glad the spec fixed that before 1.0.  Back then I discovered using 
fn:string-join() was a viable workaround.  Not sure why that worked though, as 
reading the old spec tonight I see it only accepted xs:string types as well 
(same as today).  Maybe old MarkLogic had a bug that didn't enforce that rule.

I started with XQuery back on server version 0.7.  On Solaris, which I was 
using then, it crashed every time there was a syntax error.  Oh good times.

-jh-

On Jun 11, 2011, at 10:56 AM, Evan Lenz wrote:

> Looks like it's the other way around: concat() can take xs:anyAtomicType, but 
> string-join() requires a sequence of strings.
> 
> concat(1,2,3) => "123"
> 
> Whereas:
> string-join((1,2,3),"") => (err:XPTY0004) fn:string-join((1, 2, 3), "") -- 
> arg1 is not of type xs:string*
> 
> Evan Lenz
> Software Developer, Community
> MarkLogic Corporation
> 
> Phone +1 360 297 0087
> email  [email protected]
> web    developer.marklogic.com
> 
> 
> From: Jason Hunter <[email protected]>
> Reply-To: General MarkLogic Developer Discussion 
> <[email protected]>
> Date: Fri, 10 Jun 2011 15:57:31 -0700
> To: General MarkLogic Developer Discussion <[email protected]>
> Cc: General MarkLogic Developer Discussion <[email protected]>
> Subject: Re: [MarkLogic Dev General] output PDF from MarkLogic?
> 
> It's been a while but I think I did that because concat() won't accept 
> non-string argument types. 
> 
> Sent from my iPhone
> 
> On Jun 10, 2011, at 3:42 PM, "Lee, David" <[email protected]> wrote:
> 
>> Thanks.
>> From an implementation point of view there is much use of
>>                   
>> string-join(('"',json:escape($name),'":',json:print-value($x)),"")
>>  
>> Vs. what I'd naturally do
>>        concat('"',json:escape($name),'":',json:print-value($x))
>>  
>> Is this a stylistic issue ? or is there a performance or other reason to 
>> prefer string-join ?
>>  
>>  
>>  
>> ----------------------------------------
>> David A. Lee
>> Senior Principal Software Engineer
>> Epocrates, Inc.
>> [email protected]
>> 812-482-5224
>>  
>> From: [email protected] 
>> [mailto:[email protected]] On Behalf Of Jason Hunter
>> Sent: Friday, June 10, 2011 12:57 PM
>> To: General MarkLogic Developer Discussion
>> Subject: Re: [MarkLogic Dev General] output PDF from MarkLogic?
>> 
>>  
>> 
>> FYI, as a MLJAM user you don't have to do any Java coding to use FOP.  The 
>> jam-utils.xqy has a function that does it for you.
>> 
>>  
>> 
>> (:~
>> 
>>  : Returns a PDF generated from the given XSL-FO element using the Apache
>> 
>>  : FOP 0.92 engine.
>> 
>>  :
>> 
>>  : Depends on jam:start() having previously been called.
>> 
>>  :
>> 
>>  : @param $xslfo The XSL-FO element to render as PDF
>> 
>>  : @return A binary() node holding the generated PDF document
>> 
>>  :)
>> 
>> define function jamu:fop(
>> 
>>   $xslfo as element()
>> 
>> )
>> 
>> as binary()
>> 
>>  
>> 
>> If people write other useful functions like that, send them my way and I'll 
>> incorporate them into the utils package.
>> 
>>  
>> 
>> Which reminds me, on my todo list, but someone else could easily beat me to 
>> it, is optimizing MLJAM to use MarkLogic Server's somewhat recent 
>> functionality to send and accept a raw binary POST body -- which should be a 
>> performance optimization compared to encoding/decoding the binary as a 
>> string as MLJAM does today.
>> 
>>  
>> 
>> -jh-
>> 
>>  
>> 
>> On Jun 10, 2011, at 5:08 AM, Lee, David wrote:
>> 
>> 
>> 
>> 
>> Along the lines of the other comments ...
>> 
>> What I use in production is a local tomcat server running the xmlsh servlet.
>> 
>> http://www.xmlsh.org/EmbeddingServlet
>> 
>>  
>> 
>> Then from MarkLogic I package all the files needed for a PDF (including the 
>> source XML, as well as all images)  into a ZIP stream, base64 encode it and 
>> POST it to an xmlsh servlet.
>> 
>> The servlet then unencodes, unzips the files, uses XSLT to produce FOP then 
>> Apache FOP to produce a PDF.
>> 
>> It then sends back the PDF to MarkLogic which then pushes it out to the 
>> client with the right Content-Type for PDF.
>> 
>>  
>> 
>> This allows dynamic generation of PDF from a ML hosted application, entirely 
>> scripting based (only a few lines scripting of code on both ends).
>> 
>>  
>> 
>> This is architecturally similar to the MLJAM solution but doesn't require 
>> any java coding.
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>> ----------------------------------------
>> 
>> David A. Lee
>> 
>> Senior Principal Software Engineer
>> 
>> Epocrates, Inc.
>> 
>> [email protected]
>> 
>> 812-482-5224
>> 
>>  
>> 
>> From: [email protected] 
>> [mailto:[email protected]] On Behalf Of 
>> [email protected]
>> Sent: Thursday, June 09, 2011 10:21 AM
>> To: [email protected]
>> Subject: [MarkLogic Dev General] output PDF from MarkLogic?
>> 
>>  
>> 
>> Is there a library for outputting PDF files from MarkLogic? I found plenty 
>> of information about converting PDF to XML, but what about the other way 
>> around?
>> 
>> Thanks,
>> Ryan
>> 
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
>> 
>>  
>> 
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to