views:

42

answers:

2

How to create xquery to select node values where node name starts with some text. for example document

<doc>
   <cpv1>Value1</cpv1>
   <cpv2>Value2</cpv2>
   <cpv3>Value3</cpv3>
   <zzz>Hello world!</zzz>
</doc>

It should get Value1,Value2,Value3

A: 

Here is a xpath expression which given you Value1, Value2, Value3: //*[substring(text(), 1,5) ="Value"]/text()

Skarab
A: 

//doc/*[fn:starts-with(fn:local-name(), 'cpv')]/text()

Dennis Knochenwefel