Re: [basex-talk] [xquery-talk] say how to get newline working

2012-03-11 Thread Andrew Welch
 I need to convert to text mode by hand:
 $ basex file.xq|perl -pwle 's/[^]+//g'
 As all text serialization in Xquery can't deal with the same line
 concept... unless one hardwires the line separators (0x0A) in via
 string-join, which doesn't sound much like serialization to me.


There are 2 ways of approaching this, one is a query returning
multiple items that must then be combined somehow outside of the
query, or a query that returns a single item.

Because you've gone with the former, you've now hit a problem of how
those items are being combined.  You want newlines, but other people
might want something else, like a single space, or no space at all.

So the easy way, is to just return a single item using string-join.

That said, the code you posted had an output method of html and
returned td elements... which suggests you just want indent set?



-- 
Andrew Welch
http://andrewjwelch.com
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [xquery-talk] say how to get newline working

2012-03-11 Thread Christian Grün
fyi: I have added the suggestion [1] to the latest snapshot [2].
feedback is welcome.

[1] http://docs.basex.org/wiki/Serialization#Version_7.2
[2] http://files.basex.org/releases/latest/
___

On Sun, Mar 11, 2012 at 1:09 PM, Christian Grün
christian.gr...@gmail.com wrote:
 OK, I submitted https://www.w3.org/Bugs/Public/show_bug.cgi?id=16311
 However as I have a rather hard time expressing myself,
 perhaps those who know what I am saying could add some detail to the
 bug. In the rare case the detail is wrong, I will chime in there. Thanks.

 I've added the following suggestion to the Bugzilla entry:

 I've looked up the XQuery Serialization Spec.: Step 3 in Section 2,
 Sequence Normalization, contains the sub-sentence separated by a
 single space [1], which would probably have to be extended to take an
 additional serialization parameter into account. An XQuery 3.0
 expression that uses the parameter could e.g. look as follows:

  declare option output:separator #10;;
  (1 to 10)

 Opinions are welcome.
 Christian

 [1] http://www.w3.org/TR/xslt-xquery-serialization-30/#serdm
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [xquery-talk] say how to get newline working

2012-03-10 Thread David Lee
There is, but you have to call XQuery natively instead of via the command line


-Original Message-
From: talk-boun...@x-query.com [mailto:talk-boun...@x-query.com] On Behalf Of 
jida...@jidanni.org
Sent: Saturday, March 10, 2012 5:42 PM
To: t...@x-query.com
Cc: basex-talk@mailman.uni-konstanz.de
Subject: Re: [xquery-talk] say how to get newline working

Dear t...@x-query.com, there should be a way to get 'items' back out of Xquery, 
one per line, without having to hardwire 0x0A (you know, $ perl -wle 'printf 
%08b\n , ord\n'
1010
into the code, as discussed in
https://mailman.uni-konstanz.de/pipermail/basex-talk/2012-March/002738.html )

...or require a post-processor.
___
t...@x-query.com
http://x-query.com/mailman/listinfo/talk


___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [xquery-talk] say how to get newline working

2012-03-10 Thread jidanni
 DL == David Lee d...@calldei.com writes:
DL There is, but you have to call XQuery natively instead of via the command 
line

Running the output through a tag stripper,
perl -pwle 's/[^]+//g'
sounds a 1000 times easier than trying to figure out how to do it
whatever is that way you mention.
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [xquery-talk] say how to get newline working

2012-03-10 Thread jidanni
All I know is using
$ cat file.xq
(: Make bus timetable going westbound past Zaokeng :)
declare option db:parser html;
declare option output:method html; (: etc., not poorly supported
text though :)
declare function local:d($M){
  doc(concat(http://www.fybus.com.tw/data/;, $M))
};
let $line:=(1/067b.htm,city/90.htm,city/207.htm, city/259.htm, 
city/267.htm)
let $name:=(6572,  90, 207,  259,  267)
let $correction:=(23,4,23,2,29)
for $l at $c in $line, $i in 
distinct-values(local:d($l)//*:tr/*:td[position()=2 and contains(.,:)])
let $t := xs:time(concat($i, ':00')) + xs:dayTimeDuration('PT1M') * 
$correction[$c]
order by $t
return TD{if(contains($l,259) or (contains($l,90)and 
contains($i,:00)))then 平
else 每,substring(string($t), 1, 5),
  $name[$c]}/TD

I need to convert to text mode by hand:
$ basex file.xq|perl -pwle 's/[^]+//g'
As all text serialization in Xquery can't deal with the same line
concept... unless one hardwires the line separators (0x0A) in via
string-join, which doesn't sound much like serialization to me.
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [xquery-talk] say how to get newline working

2012-03-10 Thread Liam R E Quin
On Sat, 2012-03-10 at 22:56 +, David Lee wrote:
 There is, but you have to call XQuery natively instead of via the
 command line
??!?

you can use string-join( your query here, #xa;)

or you may be able to use serialization options from the command line.

Lia

 
 
 -Original Message-
 From: talk-boun...@x-query.com [mailto:talk-boun...@x-query.com] On Behalf Of 
 jida...@jidanni.org
 Sent: Saturday, March 10, 2012 5:42 PM
 To: t...@x-query.com
 Cc: basex-talk@mailman.uni-konstanz.de
 Subject: Re: [xquery-talk] say how to get newline working
 
 Dear t...@x-query.com, there should be a way to get 'items' back out of 
 Xquery, one per line, without having to hardwire 0x0A (you know, $ perl -wle 
 'printf %08b\n , ord\n'
 1010
 into the code, as discussed in
 https://mailman.uni-konstanz.de/pipermail/basex-talk/2012-March/002738.html )
 
 ...or require a post-processor.
 ___
 t...@x-query.com
 http://x-query.com/mailman/listinfo/talk
 
 
 
 ___
 t...@x-query.com
 http://x-query.com/mailman/listinfo/talk

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [xquery-talk] say how to get newline working

2012-03-10 Thread jidanni
 LREQ == Liam R E Quin l...@w3.org writes:
LREQ On Sat, 2012-03-10 at 22:56 +, David Lee wrote:
 There is, but you have to call XQuery natively instead of via the
 command line
LREQ ??!?

LREQ you can use string-join( your query here, #xa;)

Haven't had to make my own newlines since using those Control Data
computers back in the 80's. But if you insist...

LREQ or you may be able to use serialization options from the command line.

That would be nice.
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [xquery-talk] say how to get newline working

2012-03-10 Thread David Lee
Curious, are you looking for help or just to insult people ?
 No one is insisting on anything   
If you actually want help then we need some more information like what 
processor you are using , what you are trying to achieve and what you've tried 
and what are the results.
If you just want to insult people you've done that already successfully and we 
can't help much more.

 
-David


-Original Message-
From: jida...@jidanni.org [mailto:jida...@jidanni.org] 
Sent: Saturday, March 10, 2012 9:15 PM
To: l...@w3.org
Cc: David Lee; t...@x-query.com; basex-talk@mailman.uni-konstanz.de
Subject: Re: [xquery-talk] say how to get newline working

 LREQ == Liam R E Quin l...@w3.org writes:
LREQ On Sat, 2012-03-10 at 22:56 +, David Lee wrote:
 There is, but you have to call XQuery natively instead of via the 
 command line
LREQ ??!?

LREQ you can use string-join( your query here, #xa;)

Haven't had to make my own newlines since using those Control Data computers 
back in the 80's. But if you insist...

LREQ or you may be able to use serialization options from the command line.

That would be nice.


___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [xquery-talk] say how to get newline working

2012-03-10 Thread David Lee
On Sat, 2012-03-10 at 22:56 +, David Lee wrote:
 There is, but you have to call XQuery natively instead of via the 
 command line
??!?



My reading was the OP wanted newlines without having to add them in XQuery code.
That is beyond XQuery itself so my suggestion of using a native API.
But alas I belive I've misunderstood  the entire post.


-David
d...@calldei.com

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [xquery-talk] say how to get newline working

2012-03-10 Thread Liam R E Quin
On Sun, 2012-03-11 at 10:14 +0800, jida...@jidanni.org wrote:

 Haven't had to make my own newlines since using those Control Data
 computers back in the 80's. But if you insist...

XQuery is not really a line-oriented language. I don't agree with you
that it should be as easy as seq 1 3 any more than it should be easy
to process XML documents recursively an element at a time with sed, or
to use grep only within certain elements. Unix is line-oriented, XQuery
is XML-oriented.

This is true regardless of whether you used Control Data computers.

Having said that, I can imagine a BaseX feature request - or maybe even
an XQuery feature request - for how to separate items in a sequence when
serializing. Such a request could be filed against the 3.0 serialization
spec at https://www.w3.org/Bugs/Public/ and the XQuery and XSLT Working
Groups will discuss it.

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [xquery-talk] say how to get newline working

2012-03-10 Thread jidanni
OK, I submitted https://www.w3.org/Bugs/Public/show_bug.cgi?id=16311
However as I have a rather hard time expressing myself,
perhaps those who know what I am saying could add some detail to the
bug. In the rare case the detail is wrong, I will chime in there. Thanks.
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [xquery-talk] say how to get newline working

2012-03-10 Thread jidanni
 DL == David Lee d...@calldei.com writes:
DL It looks like the CLP of DB2 gives you the behaviour you are asking for
DL 
http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=%2Fcom.ibm.db2.luw.xml.doc%2Fdoc%2Fxqrserial.html
OK maybe BaseX could do something like that, if that could indeed help
me toward my goal.
DL What is your end goal
http://x-query.com/pipermail/talk/2012-March/003828.html
I just thought I could do it all in Xquery, not needing to perl
postprocess.
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk