Hi Vijay,

I think it is because you are passing an element node into your stylesheet, so 
your match=”/” ends up not matching.  If you wrap that in a document node, like 
this (for the second param to xslt-eval):

document{<persons>
  <person name="Tarzan" id="050676"/>
  <person name="Donald" id="070754"/>
<person name="Dolly" id="050686"/>
</persons>}

Then it returns this:

<?xml version="1.0" encoding="UTF-8"?>
<html>
  <body>
    <p>
    Id: 050676<br/>
    Name: Tarzan</p>
  </body>
</html>

-Danny

From: [email protected] 
[mailto:[email protected]] On Behalf Of Vijayasekar 
Padmanaban
Sent: Friday, March 28, 2014 1:39 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Stylesheet issue

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

**************** CAUTION - Disclaimer *****************

This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely

for the use of the addressee(s). If you are not the intended recipient, please

notify the sender by e-mail and delete the original message. Further, you are 
not

to copy, disclose, or distribute this e-mail or its contents to any other 
person and

any such actions are unlawful. This e-mail may contain viruses. Infosys has 
taken

every reasonable precaution to minimize this risk, but is not liable for any 
damage

you may sustain as a result of any virus in this e-mail. You should carry out 
your

own virus checks before opening the e-mail or attachment. Infosys reserves the

right to monitor and review the content of all messages sent to or from this 
e-mail

address. Messages sent to or from this e-mail address may be stored on the

Infosys e-mail system.

***INFOSYS******** End of Disclaimer ********INFOSYS***


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

Reply via email to