0
votes

I'm learning xml stuff and can't get this simple Xquery to work.

XML:

<ModuleList>
<Module id="U08606">
<ModuleName>Discrete Mathematics</ModuleName>
</Module>
</ModuleList>

I'm trying to return the name where the attribute id starts with "U086"

XQuery:

for $i in doc("q1.xml")//ModuleList/Module
where starts-with($i/id, 'U086')
return $i/ModuleName

nothing gets returned atm, any ideas why? cheers

1

1 Answers

1
votes

Attributes are selected using the @ symbol:

starts-with($i/@id, 'U086')