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

Re: Selecting a group of elements with different names

Subject: Re: Selecting a group of elements with different names
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 21 Feb 2007 13:59:38 GMT
Re:  Selecting a group of elements with different names
>  I would like to define these object names in one 
> place and then reference them from numerous XPaths.

If you actually want to select the same elements each time use a
variable,

<xsl;variabale name="x" select="/objects/object//(list|box|group)"/>

... select="$x"

If you want to select elements with the same names, but in different
contexts, you can use a function, for example

<xsl:function name="my:f" as="xs:boolean">
  <xsl:param name="e" as="element()"/>
  <xsl:sequence select="exists($e[self::list|self::box|self::group])"/>
</xsl:function>

...

select="/objects/object//*[my:f(.)]"

David

Current Thread

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.