[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: match multiple values for an attribute

Subject: Re: match multiple values for an attribute
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 30 Aug 2006 09:49:53 +0100
xslt match multiple strings
<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="*[@style=$fonts]/text()">

does just what you ask.

David

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.