xsl-list
[Top] [All Lists]

Re: [xsl] match multiple values for an attribute

2006-08-30 01:50:15

<xsl:variable name="fonts" as="xs:string+"
                               ^^^^^^^

It's best to say explictly when you are using xslt2 as otherwise you may
get an XSLt1 answer (which would be very different in this case) xslt1 is
still the official version of xslt.

<xsl:variable name="fonts" as="xs:string+" select="('font1','font2')"/>

i want to match the text nodes that are child of an element with a style 
attribute that matches any of the fonts in $fonts.

Two things in xslt2 make this far easier than xslt1, you can have
sequences of strings in a variable, and you can use variables in match
patterns, so

<xsl:template match="*[(_at_)style=$fonts]/text()">

does just what you ask.

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>
--~--

<Prev in Thread] Current Thread [Next in Thread>