Hi Nate, The behavior of the doc and document functions are implementation dependent. Most XSLT parsers, of which most don't run on top of a specific file store, access the file-system or internet to retrieve documents. MarkLogic Server however retrieves all document from its databases only, unless you use specific functions like xdmp:http-get or xdmp:document-get. In MarkLogic Server databases, a uri like 'http://lcweb2.loc.gov/diglib/ihas/loc.natlib.ihas.200033293/mets.xml' is a valid uri and still points to a document within the database.
Moreover, doc and document are designed not to complain when the document is not found, but silently return an empty-sequence instead. You will have to use a different strategy here. You could perhaps pass the external document as a parameter, after retrieving it with xdmp:http-get, or you might be able to use xdmp:http-get directly within the XSLT. Haven't tried myself yet though.. Kind regards, Geert -----Oorspronkelijk bericht----- Van: [email protected] [mailto:[email protected]] Namens Trail, Nate Verzonden: donderdag 17 februari 2011 20:50 Aan: [email protected] Onderwerp: [MarkLogic Dev General] xslt document() function Hi, I'm having trouble getting my xslt document function to work in Marklogic server (4.2) This xslt: ============================================== <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <html> <body> <p class="test"> <a href="http://lcweb2.loc.gov/diglib/ihas/loc.natlib.ihas.200033293/mets.xml">mets file</a> <xsl:copy-of select="document('http://lcweb2.loc.gov/diglib/ihas/loc.natlib.ihas.200033293/mets.xml')"/></p> </body> </html> </xsl:template> </xsl:stylesheet> ============================================== when run within oXygen, produce the right result: ============================================== <html> <body> <p class="test"><a href="http://lcweb2.loc.gov/diglib/ihas/loc.natlib.ihas.200033293/mets.xml">mets file</a> <mets:mets xmlns:mods="http://www.loc.gov/mods/v3" xmlns:rights="http://www.loc.gov/rights/" xmlns:sm="http://www.loc.gov/mets/profiles/sheetMusic" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:lc="http://www.loc.gov/mets/profiles" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mets="http://www.loc.gov/METS/" OBJID="loc.natlib.ihas.200033293" xsi:schemaLocation="http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/mets.xsd http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/mods.xsd" PROFILE="lc:sheetMusic"> <mets:dmdSec ID="MODS1"> <mets:mdWrap MDTYPE="MODS"> <mets:xmlData> <mods:mods version="3.3"> ..... </body></html> ============================================== However, when I run it in CQ, with this xquery: xquery version "1.0-ml"; let $sourcexml:= <source></source> return try { xdmp:xslt-invoke("/path/to/my.xsl", document{$sourcexml}) } catch ($exception) { $exception } ============================================== I get this result: <html> <body> <a href="http://lcweb2.loc.gov/diglib/ihas/loc.natlib.ihas.200033293/mets.xml">mets file</a> <p class="test"/> </body> </html> I don't even get an exception... Can you tell what is going on here? I couldn't find discussion of this on the listserv... Thanks, Nate Nate Trail Network Development and MARC Standards Office Library of Congress _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
