<doc tag1="a" tag2="b" tag3="c" docTag1="d" docTag2="e"/>
I would like to output "abc"
I have the following XPATH2.0 so far
//doc/@*[name()[starts-with(.,'tag')]] which returns a node list.
Is there a better way of concatinating these?
thanks in advance for any advice
XPath 2.0 has a function string-join which you could use e.g.
string-join(//doc/(@tag1 | @tag2 | @tag3), '')
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Sorry I should have said I don't know how many attributes there could
be. There will be 1 or more - is the string-join function capable of
processing x number of attributes?
>> XPath 2.0 has a function string-join which you could use e.g.
>> string-join(//doc/(@tag1 | @tag2 | @tag3), '')
> Sorry I should have said I don't know how many attributes there could
> be. There will be 1 or more - is the string-join function capable of
> processing x number of attributes?
Well your original code already solved that problem, simply apply
string-join to the attributes where the name starts with 'tag' e.g.
string-join(//doc/@*[starts-with(local-name(), 'tag')], '')
ah of course. thanks for your time.