[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: accessing attributes
Tom,
At 03:34 PM 9/9/2008, you wrote: Wendell, Thanks for the prompt, clear reply. Advice like that so helps with learning. I take your point about using a xsl:key. I had tried this <xsl:key name="fields" match="/*/fmp:METADATA/fmp:FIELD" use="position()"/> As you've discovered, the job of position() isn't to determine a node's position in the source tree. It returns the position of a node within its processing context, what's called the "current node list", which is relative to the particular traversal in which a node is retrieved (which can be different). So it's not useful here, since a key declaration doesn't have any processing context as such. The usual solution to this problem is to determine your position directly by examining the tree. So: <xsl:key name="fields" match="/*/fmp:METADATA/fmp:FIELD" use="count(preceding-sibling::fmp:FIELD) + 1"/> will allow you to retrieve the fourth fmp:FIELD element with the key value '4', the ninth with value '9', etc. In other words, by its "position". Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|