xsl-list
[Top] [All Lists]

RE: Can I substitute a predefined path/expression within the [..] tags?

2003-01-24 02:11:01

I have several references in my stylesheet to a pattern that 
resembles:

Node[(_at_)name='AA' or @name='BB']

With time, I continuously need to update this pattern to 
include newer attributes @name='CC', @name='DD' and so on.


This will become much easier in XSLT 2.0 with functions:

<xsl:function name="with-matching-name">
  <xsl:param name="node" as="element"/>
  <xsl:result as="xs:boolean" 
    select="$node/@name = ('AA', 'BB', 'CC')"/>
</xsl:function>

<xsl:...... select="Node[with-matching-name(.)]

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 


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