[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hey there,
I am having trouble finding any information on this. I have some XML data with an attribute that has a space-delimited list inside of it (kind of like putting multiple classes on an element in html for use by CSS). How can I use XPath to match the nodes with attributes that contain a specific value. I think the best way to describe this would be with an example:
If I want to match the elements where "attribute" has one of its values "value1", I want item "a", item "b" and item "c". But if I want the elements where "attribute" has one of its values "value", I should get item "a" and item "d". If you use the contains() string function, you would obviously match all items, which is not what I want.
As I said before CSS allows you to create styles that apply to a class, and on your html, you can just set class="class1 class2 class3". That way ".class1", ".class2", ".class3", and ".class1.class2" are all separate styles! I don't need this extent of functionality, but it leads me to believe something like this just might exist in XPath.
Any ideas?
[xsl] XPath to match attribute with multiple values...?
Subject: [xsl] XPath to match attribute with multiple values...? From: Matt Dittbenner <mbditt@xxxxxxxxxxxxxxxxx> Date: Wed, 10 Nov 2004 12:36:18 -0600 |
Hey there,
I am having trouble finding any information on this. I have some XML data with an attribute that has a space-delimited list inside of it (kind of like putting multiple classes on an element in html for use by CSS). How can I use XPath to match the nodes with attributes that contain a specific value. I think the best way to describe this would be with an example:
<data> <item name="a" attribute="value value1"/> <item name="b" attribute="value2 value1"/> <item name="c" attribute="value1 value3"/> <item name="d" attribute="value"/> </data>
If I want to match the elements where "attribute" has one of its values "value1", I want item "a", item "b" and item "c". But if I want the elements where "attribute" has one of its values "value", I should get item "a" and item "d". If you use the contains() string function, you would obviously match all items, which is not what I want.
As I said before CSS allows you to create styles that apply to a class, and on your html, you can just set class="class1 class2 class3". That way ".class1", ".class2", ".class3", and ".class1.class2" are all separate styles! I don't need this extent of functionality, but it leads me to believe something like this just might exist in XPath.
Any ideas?
Thanks in advance, Matt
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Performance Tuning, Bhupendra Singh | Thread | Re: [xsl] XPath to match attribute , Emmanouil Batsis |
Re: [xsl] Re: Move (ascend) an elem, Wendell Piez | Date | Re: [xsl] XPath to match attribute , Emmanouil Batsis |
Month |