"Matthew Corr" <matthewcorr(_at_)yahoo(_dot_)com(_dot_)au> wrote in message
news:20031028054108(_dot_)66644(_dot_)qmail(_at_)web21009(_dot_)mail(_dot_)yahoo(_dot_)com(_dot_)(_dot_)(_dot_)
Hello all,
Yes I am an XSLT newbie, but I have searched
everywhere for an answer to this seemingly simple
problem with no success.
I am trying to work out a way to encapsulate comparing
a node's text with a string set for a possible match.
ie.. instead of having the following <if test> syntax
all through my multiple xslt files:
<xsl:if test="ACCTTYPE = 'AAA' or
ACCTTYPE = 'BBB' or
ACCTTYPE = 'CCC' or
ACCTTYPE = 'DDD' or
ACCTTYPE = 'EEE'">
I am curious if there is a way to define this once in
a common xslt file which is then imported into my many
xslt files, so if new types are added or removed, it
only has to be changed once?
Yes. Use:
<xsl:if test="ACCTTYPE = document('')/*/my:Types">
. . . . . .
</xsl:if>
Where my:Types is a child of xsl:stylesheet, defined like this:
<my:Types>
<type>AAA</type>
<type>BBB</type>
<type>CCC</type>
<type>DDD</type>
<type>EEE</type>
</my:Types>
and the "my" prefix is globally bound to some namespace of your choosing.
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list