ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Michael Eidenbenz <eidenbenz@arch.ethz.ch>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: btx/xml tree - entry with missing field
Date: Thu, 22 Dec 2016 20:50:57 +0100	[thread overview]
Message-ID: <CCE014EC-1FC2-451B-B3C5-EE92CBFA7B41@arch.ethz.ch> (raw)
In-Reply-To: <b2522f5a-b293-9f8f-ced7-970d350bd3e4@wxs.nl>


[-- Attachment #1.1: Type: text/plain, Size: 2768 bytes --]

thanks a lot hans!

> Am 22.12.2016 um 18:30 schrieb Hans Hagen <pragma@wxs.nl>:
> 
> On 12/22/2016 6:06 PM, Michael Eidenbenz wrote:
>> Hello
>> 
>> I use the xml interface to list all publications that dont match a
>> search criteria:
>> 
>>     /field[@name='keywords'
>>            and not (contains(text(),'alpha'))]
>> 
>> but there are entries where the keywords field is missing.
>> how can I include them (here "test-3") in the output?
>> 
>> Thanks Michael
>> 
>> --------------------------
>> 
>> \startbuffer[bib]
>> 
>> @article{test-1,
>>   title    = {Article One},
>>   author   = {A. Foo and X. Bar},
>>   year     = {2001},
>>   keywords = {alpha},
>> }
>> 
>> @book{test-2,
>>   title    = {Book Two},
>>   author   = {B. Foo},
>>   year     = {2002},
>>   keywords = {beta},
>> }
>> 
>> @whatever{test-3,
>>   title    = {Book Three},
>>   author   = {C. Foo},
>>   year     = {2003},
>> }
>> 
>> \stopbuffer
>> 
>> \usebtxdataset [database] [bib.buffer]
>> \convertbtxdatasettoxml [database]
>> 
>> \startxmlsetups btx:tag
>> \hbox{\xmlatt{#1}{tag}}
>> \stopxmlsetups
>> 
>> \startxmlsetups btx:demo
>>   \xmlfilter {#1} {
>>     /bibtex
>>     /*
>>     /field[@name='keywords'
>>            and not (contains(text(),'alpha'))]
>>     /..
>>     /command(btx:tag)
>>   }
>> \stopxmlsetups
>> 
>> \starttext
>> \xmlsetup{btx:database}{btx:demo}
>> \stoptext
> 
> \startxmlsetups btx:demo
>   \xmlfilter {#1} {/bibtex/*/command(btx:demo:action)}
> \stopxmlsetups
> 
> \startxmlsetups btx:demo:action
>    \xmldoifelse {#1} {/field[@name='keywords']} {
>        \xmlfilter {#1} {
>             /field[@name='keywords'
>                    and not contains(text(),'alpha')]
>             /..
>             /command(btx:tag)
>        }
>    } {
>        \xmlsetup{#1}{btx:tag}
>   }
> \stopxmlsetups
> 
> 
> -----------------------------------------------------------------
>                                          Hans Hagen | PRAGMA ADE
>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 6105 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2016-12-22 19:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-22 17:06 Michael Eidenbenz
2016-12-22 17:30 ` Hans Hagen
2016-12-22 19:50   ` Michael Eidenbenz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CCE014EC-1FC2-451B-B3C5-EE92CBFA7B41@arch.ethz.ch \
    --to=eidenbenz@arch.ethz.ch \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).