xsl-list
[Top] [All Lists]

Re: [xsl] Selecting a group of elements with different names

2007-02-21 06:59:54

 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--