[xquery-talk] let's comment out a line in XQuery

jidanni at jidanni.org jidanni at jidanni.org
Thu Dec 20 07:39:22 PST 2012


I don't have a Senior Secondary Certificate of Education :-) but here
goes anyway. basex: Debian's 7.3-1.
$ basex noise0.xq |wc
Stopped at line 26, column 46 in /home/jidanni/mapping/kml/noise0.xq:
[XPTY0004] Single item expected, ( ALLOW ME TO COMMENT OUT THIS LINE, ...) found.
      0       0       0
$ cat noise0.xq
(:
# Make a map of noisy neighbors, Xquery version.
# Copyright       : http://www.fsf.org/copyleft/gpl.html
# Author          : Dan Jacobson -- http://jidanni.org/
# Created On      : Sat Jan 29 17:28:12 2011
# Last Modified On: Thu Dec 20 23:29:24 2012
# Update Count    : 122
:)
declare option output:omit-xml-declaration "no";
declare function local:fol($f){
  (: just adds lines between the first point and the rest :)
  <Folder>
    {$f/*}
    <Folder>
      <name>(lines)</name>
      <open>0</open>
      {
	for $p at $c in $f/*:Placemark
	where $c > 1
	return
	<Placemark>
	  <name>{concat($f/*:Placemark[$c]//*:name/text()," to ",
	  $f/*:Placemark[ 1]//*:name/text())}</name>
	  <LineString>
	    <coordinates>{concat($f/*:Placemark[$c]//*:coordinates/text()," ",
	    $f/*:Placemark[ 1]//*:coordinates/text())}</coordinates>
	  </LineString>
	</Placemark>
}  </Folder>
</Folder>}
;
<kml xmlns="http://www.opengis.net/kml/2.2">
  {comment {"Made by noise.xq, will get OVERWRITTEN"}}
  <Document>
    <Folder>
      <name>噪音 Noise</name>
      <description>http://jidanni.org/me/quiet.html</description>
      {local:fol(
      <Folder>
        <name>慶福街 1-3 Qingfu St.</name>
	<Placemark>
	  <name>1-3</name>
	  <Point>
	    (: <coordinates> ALLOW ME TO COMMENT OUT THIS LINE</coordinates> :)
	    <coordinates>120.865201,24.181712</coordinates> (: 2012/12 Google satellite :)
	  </Point>
	</Placemark>
        <Placemark>
          <name>Luo Yuntian</name>
          <Point>
            <coordinates>120.868205,24.176483</coordinates>
          </Point>
        </Placemark>
        <Placemark>
          <name>Zhong Guilin</name>
          <Point>
            <coordinates>120.866934,24.152642</coordinates>
          </Point>
        </Placemark>
        <Placemark>
          <name>Maan Nong Zhuang</name>
          <Point>
            <coordinates>120.84368,24.17268</coordinates> (: 東勢區慶福里007鄰-東關路147號 :)
          </Point>
        </Placemark>
	</Folder>)}
	{local:fol(
	<Folder>
          <name>慶福街 1-6 Qingfu St.</name>
	  <Placemark>
	    <name>1-6</name>
	    <Point>
	      <coordinates>120.866215,24.181668</coordinates>
	    </Point>
	  </Placemark>
          <Placemark>
            <name>Liu Shiqing</name>
            <Point>
              <coordinates>120.86981,24.19667</coordinates> (: Approx :)
            </Point>
          </Placemark>
          <Placemark>
            <name>Wu Yuxuan</name>
            <Point>
              <coordinates>120.86981,24.18811</coordinates>
            </Point>
          </Placemark>
          <Placemark>
            <name>Chen Chunlai</name>
            <Point>
              <coordinates>120.877008,24.187393</coordinates>
            </Point>
          </Placemark>
          <Placemark>
            <name>Chen Zhenfeng</name>
            <Point>
              <coordinates>120.87456,24.18333</coordinates>
            </Point>
          </Placemark>
          <Placemark>
            <name>Dazhong</name>
            <Point>
              <coordinates>120.872499,24.200025</coordinates>
            </Point>
          </Placemark>
          <Placemark>
            <name>Liu Jinxing</name>
            <Point>
              <coordinates>120.874624,24.193282</coordinates>
            </Point>
          </Placemark>
          <Placemark>
            <name>Zeng Pingzhu</name>
            <Point>
              <coordinates>120.868530,24.183716</coordinates>
            </Point>
          </Placemark>
	  </Folder>)}
    </Folder>
  </Document>
</kml>



More information about the talk mailing list