[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: keys and idrefs

Subject: Re: keys and idrefs
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 9 Oct 2001 12:13:54 +0100
Re:  keys and idrefs
   <xsl:for-each 
  	 select="//process ">
                  <xsl:if test="contains(@control, $thisDoc)">
                <a href="{@id}.html"> <xsl:value-of select="name"/>
  </a>&#160;

  returns 5 process element whose control attribute contains the id value of
  the current node.

it would probably be better to do //process[.... rather than select all
processes then use an xsl:if, but wendel's point was that in th ecode
you posted.

> No, its an idrefs (plural) not an idref, 
your problem is that xslt/xpath care 'nowt about such attribute
declarations. If XPath knew that attribute was a list type you'd
probably be in better shape.

If you are prepared to limit yourself to a fixed length then you could
use keys (but you'd have to experiment to see if it was really any
better than the simple use of // as you show above)

but to find all process elements that contain XAG in their control
attribute you could do

select="key('control', 'XAG')"

so long as you key was defined something like


<xsl:key match="process" use="@control"/>
<xsl:key match="process" use="substring-before(@control,' ')"/>
<xsl:key match="process" use="substring-after(@control,' ')"/>
<xsl:key match="process" use="substring-before(substring-after(@control,' '),' ')"/>
....


David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • keys and idrefs
    • DPawson - Fri, 5 Oct 2001 04:08:07 -0400 (EDT)
      • <Possible follow-ups>
      • DPawson - Tue, 9 Oct 2001 06:50:12 -0400 (EDT)
        • David Carlisle - Tue, 9 Oct 2001 07:27:38 -0400 (EDT) <=
        • Wendell Piez - Tue, 9 Oct 2001 11:50:03 -0400 (EDT)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.