Hi Vijay,

I think it has to do with passing an element instead of a document to the
xslt.  Check out the usage notest for xslt-eval.  While playing around I
also got the impression that key() may need to be used in a document-rooted
node.

Anyway, try wrapping your data up as

document { <persons> ... </persons> }

That worked for me.


- Chris


On Fri, Mar 28, 2014 at 4:39 AM, Vijayasekar Padmanaban <
[email protected]> wrote:

>  Hi,
>
>
>
> I am trying to transform xml using stylesheet in Marklogic 6.0-4 version.
> I see a strange problem with keys used in stylesheet. The below code gives
> me empty result whereas I expect it to return some results. Can someone
> tell me what could be the problem is?
>
>
>
> xdmp:xslt-eval(
>
> <xsl:stylesheet version="1.0"
>
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>
> <xsl:key name="preg" match="person" use="@id"/>
>
> <xsl:template match="/">
>
>   <html>
>
>   <body>
>
>   <xsl:for-each select="key('preg','050676')">
>
>     <p>
>
>     Id: <xsl:value-of select="@id"/><br />
>
>     Name: <xsl:value-of select="@name"/>
>
>     </p>
>
>   </xsl:for-each>
>
>   </body>
>
>   </html>
>
> </xsl:template>
>
> </xsl:stylesheet>
>
> ,
>
> <persons>
>
>   <person name="Tarzan" id="050676"/>
>
>   <person name="Donald" id="070754"/>
>
>  <person name="Dolly" id="050686"/>
>
> </persons>,())
>
>
>
> Regards
>
> Vijay
>
>
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to