XQuery way to strip whitespace
File: Data.xml
<?xml version="1.0"?>
<bib>
<book year="1988">
<title>title 1</title>
</book>
<book year="2004">
<title>title 2</title>
</book>
</bib>
File: Query.xquery
xquery version "1.0";
declare boundary-space strip;
<myNewBib>{
doc("Data.xml")/bib/book[@year > 2005]
}</myNewBib>
Output:
<?xml version="1.0" encoding="UTF-8"?>
<myNewBib/>
Related examples in the same category