Hello,
We read "The PITarget of a processing instruction may not consist of the characters "XML" in any combination of upper and lower case. The DirPIContents of a processing instruction may not contain the string "?>"."
So how can one output the line <?xml version="1.0" encoding="UTF-8"?>
I need to put it at the top of my output.
Also, is there a way to only write the fn:matches line once here?:
let $d := doc("p.xml") let $region := ('基隆|新北|台北','桃園|新竹|苗栗','台中|彰化|南投','雲林|嘉義|台南', '高雄|屏東','宜蘭|花蓮|台東','澎湖|金門|連江') for $count in 1 to count($region) return <Folder> <name>{$region[$count]}({count($d/Folder/Placemark[fn:matches(./description, concat('/li><li>','(',$region[$count],')'))])})</name> <open>0</open> {$d/Folder/Placemark[fn:matches(./description, concat('/li><li>','(',$region[$count],')'))]} </Folder>
Also, in perl one can use decode_entities() to convert < to < etc., however reading http://www.w3.org/TR/xpath-functions/ one notes xquery has no such function. What if I want to reduce my output by using CDATA instead? Or maybe xquery output must be valid XML no ifs ands or buts.
Hi Jidanni,
you can specify an output declaration on top of your query [1]:
declare option output:omit-xml-declaration "no";
Hope this helps, Christian
[1] http://docs.basex.org/wiki/Serialization ___________________________
On Mon, Nov 28, 2011 at 2:51 PM, jidanni@jidanni.org wrote:
Hello,
We read "The PITarget of a processing instruction may not consist of the characters "XML" in any combination of upper and lower case. The DirPIContents of a processing instruction may not contain the string "?>"."
So how can one output the line
<?xml version="1.0" encoding="UTF-8"?>
I need to put it at the top of my output.
Also, is there a way to only write the fn:matches line once here?:
let $d := doc("p.xml") let $region := ('基隆|新北|台北','桃園|新竹|苗栗','台中|彰化|南投','雲林|嘉義|台南', '高雄|屏東','宜蘭|花蓮|台東','澎湖|金門|連江') for $count in 1 to count($region) return
<Folder> <name>{$region[$count]}({count($d/Folder/Placemark[fn:matches(./description, concat('/li><li>','(',$region[$count],')'))])})</name> <open>0</open> {$d/Folder/Placemark[fn:matches(./description, concat('/li><li>','(',$region[$count],')'))]} </Folder>
Also, in perl one can use decode_entities() to convert < to < etc., however reading http://www.w3.org/TR/xpath-functions/ one notes xquery has no such function. What if I want to reduce my output by using CDATA instead? Or maybe xquery output must be valid XML no ifs ands or buts. _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de