1%D \module 2%D [ file=publ-xml, 3%D version=2013.12.24, 4%D title=\CONTEXT\ Publication Support, 5%D subtitle=XML, 6%D author=Hans Hagen, 7%D date=\currentdate, 8%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] 9%C 10%C This module is part of the \CONTEXT\ macro||package and is 11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for 12%C details. 13 14\writestatus{loading}{ConTeXt Publication Support / XML} 15 16\unprotect 17 18\permanent\tolerant\protected\def[#1]% 19 {{\ifparameter#1\or#1\else\s!default\fi}} % or current when not empty 20 21% \startxmlsetups btx:initialize 22% \xmlregistereddocumentsetups{#1}{} 23% \xmlsetsetup{#1}{bibtex|entry|field}{btx:*} 24% \xmlmain{#1} 25% \stopxmlsetups 26 27 btx:initialize 28 {#1}{bibtex|entry|field}{btx:*} 29 {#1} 30 31 32% \startxmlsetups btx:entry 33% \xmlflush{#1} 34% \stopxmlsetups 35 36 btx:field 37 {#1} 38 39 40\protect \endinput 41 42% \startxmlsetups bibtex:entry:getkeys 43% \xmladdsortentry{bibtex}{#1}{\xmlfilter{#1}{/field[@name='author']/text()}} 44% \xmladdsortentry{bibtex}{#1}{\xmlfilter{#1}{/field[@name='year' ]/text()}} 45% \xmladdsortentry{bibtex}{#1}{\xmlatt{#1}{tag}} 46% \stopxmlsetups 47 48% \startbuffer 49% \startxmlsetups xml:bibtex:sorter 50% \xmlresetsorter{bibtex} 51% % \xmlfilter{#1}{entry/command(bibtex:entry:getkeys)} 52% \xmlfilter{#1}{ 53% bibtex 54% /entry[@category='article'] 55% /field[@name='author' and find(text(),'Knuth')] 56% /../command(bibtex:entry:getkeys)} 57% \xmlsortentries{bibtex} 58% \xmlflushsorter{bibtex}{bibtex:entry:flush} 59% \stopxmlsetups 60% \stopbuffer 61 62% \bgroup 63% \setups[bibtex-commands] 64% \getbuffer 65% \egroup 66 67% \startxmlsetups bibtex:entry:flush 68% \xmlfilter{#1}{/field[@name='author']/context()} / % 69% \xmlfilter{#1}{/field[@name='year' ]/context()} / % 70% \xmlatt{#1}{tag}\par 71% \stopxmlsetups 72 73% \startpacked 74% \getbuffer 75% \stoppacked 76 77 78% \protected\def\btx_xml_list_handle_entry 79% {\begingroup 80% \ignorespaces 81% \xmlfilter{btx:\currentbtxrendering}{/bibtex/entry[@tag='\currentbtxtag']/command(btx:format)}% 82% \removeunwantedspaces 83% \endgroup} 84 85% \startxmlsetups btx:format 86% \btxlistparameter\c!before\relax % prevents lookahead 87% \edef\currentbibxmlnode {#1} 88% \edef\currentbibxmltag {\xmlatt{#1}{tag}} 89% \edef\currentbtxcategory{\xmlatt{#1}{category}} 90% \ignorespaces 91% \xmlcommand{#1}{.}{btx:\currentbtxformat:\currentbibxmlcategory} 92% \removeunwantedspaces 93% \btxlistparameter\c!after\relax % prevents lookahead 94% \stopxmlsetups 95 96% \startxmlsetups btx:list 97% \xmlfilter{#1}{/bibtex/entry/command(bibtex:format)} 98% \stopxmlsetups 99 100% \startxmlsetups btx:btx 101% \xmlfilter{#1}{/entry/command(btx:format)} 102% \stopxmlsetups 103 104% \protected\def\btx_xml_doifelse#1{\xmldoifelse\currentbibxmlnode{/field[@name='#1']}} 105% \protected\def\btx_xml_doif #1{\xmldoif \currentbibxmlnode{/field[@name='#1']}} 106% \protected\def\btx_xml_doifnot #1{\xmldoifnot \currentbibxmlnode{/field[@name='#1']}} 107% \def\btx_xml_flush #1{\xmlcontext \currentbibxmlnode{/field[@name='#1']}} 108% \def\btx_xml_setup {\xmlsetup \currentbibxmlnode} % {#1} 109% \protected\def\btx_xml_todo #1{[#1]} 110 111% \xmlfilter{#1}{/field[@name='\currentbtxfield']/btxconcat('\currentbtxfield')} 112 |