Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 25th, 2010, 12:20 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default xsl:key - only for input xml?

Hi,

Just a question; does the xsl:key only index elements from the source input xml?

For example, if I use the doc() function to pull in xml fragments, does the key know to index any elements that apply in the xml that was pulled in with doc()?

Thanks for the help.
 
Old March 25th, 2010, 12:27 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

xsl: key defines keys for any input document you use, whether it is the primary one or a secondary one you load with "document" or "doc" does not matter. But a key is built for each document and one call to the "key" function only finds nodes in one document so you need to make sure you use e.g. "key('key-name', 'foo')" with the right context node or you use e.g. "key('key-name', 'foo', doc('bar.xml'))" to provide the context.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old March 25th, 2010, 03:38 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Great. Thanks for the explanation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using key() and <xsl:key> freddy XSLT 2 January 18th, 2007 08:55 PM
<bean:message key="PNR.INPUT"/> key has null value warsha_14 Struts 1 November 13th, 2006 07:26 AM
xml and xsl templates as input to xslt gives xml rameshnarayan XSLT 5 August 3rd, 2005 01:58 AM
using xsl:value-of as a value of an input-text aldwinenriquez XSLT 3 June 23rd, 2005 03:02 AM
selection within xsl:key Kabe XSLT 4 February 25th, 2005 05:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.