Hi David,
That is correct, but those examples are using Saxon parser. Saxon is not backed by a database. MarkLogic will retrieve documents from its documents database when using doc() or document(), in both XQuery and XSLT. Both is compliant with the W3C standard.. Kind regards, Geert *Van:* general-boun...@developer.marklogic.com [mailto: general-boun...@developer.marklogic.com] *Namens *Steiner, David J. (LNG-DAY) *Verzonden:* dinsdag 18 februari 2014 15:28 *Aan:* MarkLogic Developer Discussion *Onderwerp:* Re: [MarkLogic Dev General] using document() in xslt to get data from a different DB Yeah, the xdmp:http-get works from within the xslt. I was just reading a post<http://stackoverflow.com/questions/18427409/xslt-document-function-where-remote-object-is-identified-by-a-variable-possi>in stackoverflow, which seemed to suggest that 'document' in xslt is capable of this, so I was trying to get it to work. Thanks, David *From:* general-boun...@developer.marklogic.com [ mailto:general-boun...@developer.marklogic.com<general-boun...@developer.marklogic.com>] *On Behalf Of *Geert J. *Sent:* Tuesday, February 18, 2014 8:49 AM *To:* MarkLogic Developer Discussion *Subject:* Re: [MarkLogic Dev General] using document() in xslt to get data from a different DB Hi David, Use xdmp:http-get from within your XSLT as well. Document and doc expect the http-path to be a database uri, so look only inside your documents database, not externally. Otherwise doc or document should have retrieved your doc from QConsole remotely as well, and that is not the case.. Kind regards, Geert *Van:* general-boun...@developer.marklogic.com [mailto: general-boun...@developer.marklogic.com] *Namens *Steiner, David J. (LNG-DAY) *Verzonden:* dinsdag 18 februari 2014 14:40 *Aan:* MarkLogic Developer Discussion *Onderwerp:* Re: [MarkLogic Dev General] using document() in xslt to get data from a different DB I don't think it's permissions, or at least if it is, I can't see how. I can use this from qconsole and it returns just fine. xdmp:http-get("http://host:port/getNameService.xqy?id=id", <options xmlns="xdmp:http"> </options>) *From:* general-boun...@developer.marklogic.com [ mailto:general-boun...@developer.marklogic.com<general-boun...@developer.marklogic.com>] *On Behalf Of *sai shanker *Sent:* Saturday, February 15, 2014 9:45 AM *To:* MarkLogic Developer Discussion *Subject:* Re: [MarkLogic Dev General] using document() in xslt to get data from a different DB Hello David, Can you please check "*authentication" and "default user"* *settings for the http server.* *also what is the user that you used to load the xquery code?* *all must be in sync.* *just for sake i used "application-level" and "admin" and loaded the code with "admin" and that worked for me from the xml document.* *Thanks and Regards,* *Sai.* On Friday, February 14, 2014 3:04 PM, "Steiner, David J. (LNG-DAY)" < david.j.stei...@elsevier.com> wrote: I'm trying to modify the "Content Display" custom XSLT. I'd like to be able to get a bit of information from a different DB, so I've written a tiny service to return that info and it executes on a different port: This is the service: xquery version "1.0-ml"; let $id := xdmp:get-request-field("id") return document { <doc> <name> { xdmp:eval(fn:concat('fn:data(fn:doc("',fn:concat("/path/", fn:data($id), ".xml"), '")/doc/name)'), (), <options xmlns="xdmp:eval"> <database>{xdmp:database("db2")}</database> </options>) } </name> </doc> And calling this service works fine from a browser or qconsole. I'd like to be able to call it from the XSLT, so I've tried this: <xsl:stylesheet version="2.0" exclude-result-prefixes="html" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:_1="http://marklogic.com/xdmp/property" xmlns:html=" http://www.w3.org/1999/xhtml"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:template match="_1:last-modified"/> <xsl:template match="root"><div class="render-root"><xsl:apply-templates/></div></xsl:template> <xsl:template match="id"> <p class="render-id"> Name: <xsl:value-of select="document(concat('http://host:port/getNameService.xqy?id=', .))//name"/> </p> </xsl:template> <xsl:template match="html:*"><xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates/></xsl:copy></xsl:template> </xsl:stylesheet> I know that the concat produces the string that I'd want - if I simply copy the string into a browser, I get what I'm expecting when hitting enter, but executing this stylesheet, I get nothing, whether I run it from qconsole or through app builder. So, is something like this supposed to work and I'm just not doing it right, or am I completely wrong in thinking that this should work? Thanks, David _______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general