Hi I do have XML as below:
<?xml version="1.0" encoding="UTF-8"?>
<library>
<book publisher="Del Rey">
<series>The Lord of the Pings</series>
<title>Way Station</title>
<author>Clifford D. Simak</author>
</book>
<book publisher="Del Rey">
<series>The Lord of the Rings</series>
<title>The Fellowship of the Ring</title>
<author>J.R.R. Tolkien</author>
</book>
<book publisher="Del Rey">
<series>The Lord of the Rings</series>
<title>The Two Towers</title>
<author>J.R.R. Tolkien</author>
</book>
<book publisher="Del Rey">
<series>The Lord of the Rings</series>
<title>The Return of the King</title>
<author>J.R.R. Tolkien</author>
</book>
<book publisher="Ace">
<series>Lord Darcy</series>
<title>Too Many Magicians</title>
<author>Randall Garrett</author>
</book>
<book publisher="Ace">
<series>Lord Darcy</series>
<title>Murder and Magic</title>
<author>Randall Garrett</author>
</book>
<book publisher="Ace">
<series>Lord Darcy</series>
<title>The Napoli Express</title>
<author>Randall Garrett</author>
</book>
<book publisher="Ace">
<series>Lord Darcy</series>
<title>Lord Darcy Investigates</title>
<author>Randall Garrett</author>
</book>
</library>
I am trying to create an xpath expression to count the number books,under <library> .. </library>
using count()
. But I couldn't figure out.
Any help in this regard?