1

I write this query in eXist-db (eXide):

doc("/db/libros/prueba.xhtml")/html/body/p/a/@href

Find two results: Found 2 in 0.003s

But the screen does not show any

Input document is:

<html>
<head>
    <title> titulo </title>
</head>
<body>
<p class="clase1"> esto es un parrafo <a href="www.wikipedia.com"> wikipedia </a></p>
<p> otro parrafo <a href="www.youtube.com">youtube</a></p>
</body>
</html>

the system is

kernel : Linux 3.5.0-27-generic (x86_64)

Distribution Linux Mint 14 Nadia

eXist Version:  2.0
eXist Build:    20130207
Joe Wicentowski
  • 5,159
  • 16
  • 26
wester1991
  • 25
  • 1
  • 4

1 Answers1

1

I think you need to put data() around. Have a look:

data(doc("file:/C:/Users/vgv/Desktop/Testing/Untitled1.xml")/html/body/p/a/@href)

output:

www.wikipedia.com www.youtube.com
Navin Rawat
  • 3,208
  • 1
  • 19
  • 31
  • Navin is correct. Your query returns attribute nodes, but you want the string value of those nodes. The data() function that Navin suggested would return the typed value of the attribute nodes, but the string() function might be more specific in getting the nodes' string value: `doc("file:/C:/Users/vgv/Desktop/Testing/Untitled1.xml")/html/body/p/a/@href/string()` This is really an XQuery issue, not one specific to eXide. – Joe Wicentowski May 23 '13 at 19:21