Using http://www.xpathtester.com/ to fixup the xml I get <?xml version="1.0" encoding="UTF-8"?>
<book xmlns:book="http://generated.ns/book">
<book:chapter id="bk444444ch1" type="CHAPTER">
<book:locator xmlns:xlink="http://www.w3.org/1999/xlink" xlink:hre
+f="/book/isbn/979-0-4444-1000-17/book-part/chapter/bk444444ch1?releas
+eStatus=RELEASED" xlink:title="Photonic crystal light-emitting source
+s" xlink:type="locator"></book:locator>
<book:locator xmlns:xlink="http://www.w3.org/1999/xlink" xlink:hre
+f="/book/isbn/979-0-4444-1000-17/book-part/chapter/bk444444ch1?releas
+eStatus=RELEASED&format=pdf" xlink:title="Photonic crystal light-
+emitting sources" xlink:type="locator"></book:locator>
<book:locator xmlns:xlink="http://www.w3.org/1999/xlink" xlink:hre
+f="/book/isbn/979-0-4444-1000-17/book-part/chapter/bk444444ch1?releas
+eStatus=RELEASED&format=epub" xlink:title="Photonic crystal light
+-emitting sources" xlink:type="locator"></book:locator>
</book:chapter>
</book>
And then setns/query using xmllint --shell $ xmllint.exe --shell ravi06-03.xml
/ >
/ > whereis //@xlink:href
XPath error : Undefined namespace prefix
xmlXPathEval: evaluation failed
//@xlink:href: no such node
/ >
/ > setns xlink=http://www.w3.org/1999/xlink
/ >
/ > whereis //@xlink:href
/book/book:chapter/book:locator[1]/@xlink:href
/book/book:chapter/book:locator[2]/@xlink:href
/book/book:chapter/book:locator[3]/@xlink:href
/ >
/ > cat //@xlink:href
-------
xlink:href="/book/isbn/979-0-4444-1000-17/book-part/chapter/bk444444c
+h1?releaseStatus=RELEASED"
-------
xlink:href="/book/isbn/979-0-4444-1000-17/book-part/chapter/bk444444c
+h1?releaseStatus=RELEASED&format=pdf"
-------
xlink:href="/book/isbn/979-0-4444-1000-17/book-part/chapter/bk444444c
+h1?releaseStatus=RELEASED&format=epub"
/ >
/ >
/ > cat (//@xlink:href/..)[1]
-------
<book:locator xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/
+book/isbn/979-0-4444-1000-17/book-part/chapter/bk4
44444ch1?releaseStatus=RELEASED" xlink:title="Photonic crystal light-e
+mitting sources" xlink:type="locator"/>
/ >
/ >
/ > bye
$
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|