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

Subject: Re: [xsl] Selecting a group of elements with different names
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 21 Feb 2007 13:59:38 GMT
>  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