Subject: Re: [xsl] String sequence as key match From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Mon, 22 Mar 2010 15:14:56 +0100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] String sequence as key match, Martynas Jusevicius | Thread | Re: [xsl] String sequence as key ma, Martynas Jusevicius |
[xsl] String sequence as key match, Martynas Jusevicius | Date | Re: [xsl] String sequence as key ma, Martynas Jusevicius |
Month |