Re: [basex-talk] how to nest tags using a conditional

2020-02-19 Thread thufir




On 2020-02-19 6:10 a.m., Martin Honnen wrote:

Am 19.02.2020 um 15:08 schrieb thufir:

How can I start a new "record" and then nest tags in that record?


but I'm getting output like:


  
  if (matches($line, "[0-9]"))
  then people
  else people
  
  
  if (matches($line, "[0-9]"))
  then joe
  else joe
  
..

wheras I just want output like:


  joe
  123



the query:

xquery version "3.0";


{
for $line in db:open("foo.txt")//text()
return
    



Nest any contained expression in further curly braces

   {


  if (matches($line, "[0-9]"))
  then {$line}
  else {$line}



}



}






that was quite helpful, thanks.  I'm getting:


joe
  
  
phone1
  
  
phone2
  


and want to only open the new record tab for something like:



joe
phone1
phone2



but get "incomplete if statement" when I try to add open and close 
record tags inside each if statement.


xquery version "3.0";


{
for $line in db:open("foo.txt")//text()
return

{
   if (matches($line, "[0-9]"))
   then {$line}
   else {$line}
}
 
}
 




thanks,

Thufir


Re: [basex-talk] how to nest tags using a conditional

2020-02-19 Thread Martin Honnen

Am 19.02.2020 um 15:08 schrieb thufir:

How can I start a new "record" and then nest tags in that record?


but I'm getting output like:


  
  if (matches($line, "[0-9]"))
  then people
  else people
  
  
  if (matches($line, "[0-9]"))
  then joe
  else joe
  
..

wheras I just want output like:


  joe
  123



the query:

xquery version "3.0";


{
for $line in db:open("foo.txt")//text()
return
    



Nest any contained expression in further curly braces

  {


  if (matches($line, "[0-9]"))
  then {$line}
  else {$line}



}



}










[basex-talk] how to nest tags using a conditional

2020-02-19 Thread thufir

How can I start a new "record" and then nest tags in that record?


but I'm getting output like:


  
  if (matches($line, "[0-9]"))
  then people
  else people
  
  
  if (matches($line, "[0-9]"))
  then joe
  else joe
  
..

wheras I just want output like:


  joe
  123



the query:

xquery version "3.0";


{
for $line in db:open("foo.txt")//text()
return

  if (matches($line, "[0-9]"))
  then {$line}
  else {$line}

}




I think it's a matter of using the () and {} correctly.  Pardon, yes, 
I'm literally reading a book on this, still trying to understand the syntax.




thanks,

Thufir