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

Re: String sequence as key match

Subject: Re: String sequence as key match
From: Martynas Jusevicius <martynas.jusevicius@xxxxxxxxx>
Date: Mon, 22 Mar 2010 15:26:40 +0100
Re:  String sequence as key match
Obviously :) I must have been trying too hard..
Thanks

On Mon, Mar 22, 2010 at 3:14 PM, Martin Honnen <Martin.Honnen@xxxxxx> wrote:
> Martynas Jusevicius wrote:
>
>> I used to use a key declaration like this
>> <xsl:key name="element-by-class" match="h:*" use="@class"/>
>> to match XHTML elements like <p class="Quote"> by supplying a classname:
>> key('element-by-class', 'Quote')
>>
>> But now I have changed my XHTML input so that the class attribute can
>> actually include multiple classnames, for example:
>> <p class="Quote Text_body">
>>
>> I managed to fix my template matches by using h:p[@class/tokenize(., '
>> ') = 'Quote'] instead of simply h:p[@class = 'Quote'].
>>
>> But what about that key declaration, can I change it in the same way
>> to take into account every classname from the @class attribute? Maybe
>> using contains() or tokenize() somehow? So that
>> key('element-by-class', 'Quote') would still match an element if one
>> of its classnames is 'Quote'.
>
> Yes,
>  use="tokenize(@class, '\s+')"
> should do.
>
> --
>
>        Martin Honnen
>        http://msmvps.com/blogs/martin_honnen/

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-2013 All Rights Reserved.