XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
soundari rSubject: xsl:key and key () with input as more than one value - urgent
Author: soundari r
Date: 13 Oct 2005 06:48 AM
Hi,

I am new to use xsl:key functionality. My understanding is u
can reference a key and obtain the corresponding value from an
external xml file. Is that possible to give two or three values
for the query and retrieve one value.

For example:

i want to give empid, and department as input . the output would be
some value matching these two values.

Even in the referenced xml i have the values as
<empid> and <department> and <result> as elements. Its quite urgent.
Any help in this is appreciated.

Thanks in Advance.

Postnext
(Deleted User) Subject: xsl:key and key () with input as more than one value - urgent
Author: (Deleted User)
Date: 13 Oct 2005 11:07 AM
It is up to you to assign a value to the "use" attribute of "key" element. This "use" string will be calculated for each node matching
the pattern (specified as a value of "match" attribute) and the node
will be inserted into the map (actually multimap) using calculated "use" as a key. Take a look at this example:

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="MultiValueKey" match = "/xml/record" use = "concat(key1,key2)" />

<xsl:template match="/">
<xml>
<xsl:for-each select = "key('MultiValueKey','aa')">
<result>
Found: <xsl:value-of select="."/>
</result>
</xsl:for-each>
</xml>
</xsl:template>

</xsl:stylesheet>

processing this xml:

<xml>
<record>
<key1>a</key1>
<key2>a</key2>
</record>
<record>
<key1>a</key1>
<key2>b</key2>
</record>
<record>
<key1>a</key1>
<key2>c</key2>
</record>
<record>
<key1>b</key1>
<key2>a</key2>
</record>
<record>
<key1>b</key1>
<key2>b</key2>
</record>
<record>
<key1>b</key1>
<key2>c</key2>
</record>
</xml>

Posttop
soundari rSubject: xsl:key and key () with input as more than one value - urgent
Author: soundari r
Date: 19 Oct 2005 04:37 AM
Hi,

Thanks for the reply.and it helps me a lot
to understand and solve the problem.

Thanks once again.!

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.