Map keys are just strings, and xslt-eval sees 'ns:p' as just a string with a
colon in it. The xslt-eval function does understand Clark-notation QNames, per
http://docs.marklogic.com/xdmp:xslt-eval
> Each key in the map is a string representing the name of the parameter in
> Clark notation: "{namespaceURI}localname". The function xdmp:key-from-QName
> is a convenient way to generate these keys. Each entry in the map is the
> value of the corresponding parameter.
So the key should be '{http://example.org/}p'. You could code that directly
into the map:put, or use something like this:
map:put($params, xdmp:key-from-QName(xs:QName("ns:p")), "world")
With that change I can run your example in cq, using MarkLogic Server 6.0-1.1
on OS X.
-- Mike
On 4 Nov 2012, at 08:43 , Florent Georges <[email protected]> wrote:
> Hi,
>
> I am using xdmp:xslt-eval() to evaluate an XSLT stylesheet
> dynamically constructed in a query. I can pass a global parameter
> to the stylesheet by using a map. But only when the parameter
> name is in no namespace. When the parameter name is in a
> namespace, regarless whatever I try, I get the following error:
>
> XSLT-DEFAULTESAS: (err:XTDE0610) <xsl:param name="{ ns:p }"
> as="{ item()+ }"/> -- Invalid empty-sequence() default value
> coercion for variable or parameter: empty-sequence() as
> item()+
>
> What I tried is:
>
> declare namespace ns = "http://example.org/";
>
> let $params := map:map()
> let $dummy := map:put($params, "ns:p", "world")
> return
> xdmp:xslt-eval(
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:ns="http://example.org/"
> version="2.0">
> <xsl:param name="ns:p" as="item()+"/>
> <xsl:template name="ns:main">
> <hello>
> <xsl:value-of select="$ns:p"/>
> </hello>
> </xsl:template>
> </xsl:stylesheet>,
> (),
> $params,
> <options xmlns="xdmp:eval">
> <template>ns:main</template>
> </options>)
>
> This example is self-complete and run in QConsole.
>
> What did I miss?
>
> Regards,
>
> --
> Florent Georges
> http://fgeorges.org/
> http://h2oconsulting.be/
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general