From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/31297 Path: news.gmane.org!not-for-mail From: Michael Wigston Newsgroups: gmane.comp.tex.context Subject: Problems mapping Xml into ConTeXt Date: Wed, 11 Oct 2006 15:12:02 +1000 Message-ID: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0041077510==" X-Trace: sea.gmane.org 1160543567 6871 80.91.229.2 (11 Oct 2006 05:12:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 11 Oct 2006 05:12:47 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Wed Oct 11 07:12:45 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1GXWOZ-0000HR-F8 for gctc-ntg-context-518@m.gmane.org; Wed, 11 Oct 2006 07:12:43 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 215701FDD8; Wed, 11 Oct 2006 07:12:42 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 08074-03; Wed, 11 Oct 2006 07:12:35 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 017B21FD8D; Wed, 11 Oct 2006 07:12:34 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 54F0F1FD8D for ; Wed, 11 Oct 2006 07:12:30 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06587-06-2 for ; Wed, 11 Oct 2006 07:12:20 +0200 (CEST) Original-Received: from twonetom19.sge.net (twonetom19.sge.net [152.91.2.19]) by ronja.ntg.nl (Postfix) with SMTP id 588B51FD7D for ; Wed, 11 Oct 2006 07:12:18 +0200 (CEST) Original-Received: from twonetvs10.sge.net (twonetvs-om [152.91.2.17]) by twonetom19.sge.net (Postfix) with ESMTP id ABB56C590 for ; Wed, 11 Oct 2006 15:12:11 +1000 (EST) Original-Received: from twonetvs10.sge.net (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id 713A0447F9 for ; Wed, 11 Oct 2006 15:12:11 +1000 (EST) Original-Received: from quark.sge.net (unknown [152.91.9.198]) by twonetvs10.sge.net (Postfix) with ESMTP id 4674D4401D for ; Wed, 11 Oct 2006 15:12:10 +1000 (EST) Original-Received: from rbamsw3.a1.asic.gov.au (unknown [10.11.2.19]) by quark.sge.net (Postfix) with ESMTP id 9CF951EDA1E for ; Wed, 11 Oct 2006 15:12:07 +1000 (EST) Original-Received: from rbagln2.asic.gov.au (rbagln2.asic.gov.au) by rbamsw3.a1.asic.gov.au (Clearswift SMTPRS 5.2.3) with ESMTP id for ; Wed, 11 Oct 2006 15:12:09 +1000 Original-Received: from rbagln2.asic.gov.au ([127.0.0.1]) by rbagln2.asic.gov.au with InterScan Message Security Suite; Wed, 11 Oct 2006 15:12:05 +1000 Original-To: ntg-context@ntg.nl X-Mailer: Lotus Notes 653HF122 February 15, 2005 X-MIMETrack: Serialize by Router on RBAGLN2/Sydney/NSW/ASIC(Release 6.5.4|March 27, 2005) at 11/10/2006 15:12:05, Serialize complete at 11/10/2006 15:12:05 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:31297 Archived-At: This is a multipart message in MIME format. --===============0041077510== Content-Type: multipart/alternative; boundary="=_alternative 001C9153CA257204_=" This is a multipart message in MIME format. --=_alternative 001C9153CA257204_= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi everyone, I am attempting to map some XML into ConTeXt as described in the manual "XML in ConTeXt". Essentially we have a bunch of tagged text (the XML "loosely" based on some of the XHTML tags) from which we want to produce PDF letters for dispatch (via email, post etc). I am having particular problems implementing the following commands: - \underbar, \underbars, \overstrike, \overstrikes, \low, \high and \lohi I was expecting that they would all easily be defined using the \defineXMLgrouped [name] {command} element mapping. There is probably something very simple that I have not setup correctly since I am sure that this has been attempted before and would appreciate pointers as to where I am going wrong. The following attempts at mapping element to \underbar illustrates my problem which also seems largely applicable to the , and mapping: - 1. This def of does nothing ... \defineXMLgrouped [u] \underbar 2. This def of also does nothing ... \defineXMLgrouped [u] {\groupedcommand{\underbar}{}} 3. This def of underlines the 1st character only ... \defineXMLenvironment [u] {\bgroup\underbar} {\egroup} 4. In the mailing list, there is a suggestion that \underbar does not allow line-breaking, so I also tried the following. This def of "works" partially, in that it does underline, however it causes havoc with alignment - everything seems to shift over to the right about 4cm ... \defineXMLenvironment [u] \startul \stopul \definetextbackground[ul] [location=text,alternative=1,background=,frame=off] \definestartstop[ul] [before={\starttextbackground[ul] }, after={\stoptextbackground\ }] Below is a sample .tex file that I have been playing with: - \usemodule [contml] \autoXMLnamespace [context] % Attempts at defining a mapping for : - % This def of does nothing ... %\defineXMLgrouped [u] \underbar % This def of does nothing ... %\defineXMLgrouped [u] {\groupedcommand{\underbar}{}} % This def of underlines the 1st character only ... %\defineXMLenvironment [u] {\bgroup\underbar} {\egroup} % % This def of "works" partially, in that it does underline, however it % causes havoc with alignment - everything seems to shift over to the right % about 4cm ... \defineXMLenvironment [u] \startul \stopul \definetextbackground[ul] [location=text,alternative=1,background=,frame=off] \definestartstop[ul] [before={\starttextbackground[ul] }, % after={\stoptextbackground\fixedspaces}] after={\stoptextbackground\ }] % Other mappings \defineXMLgrouped [right] \rightaligned \defineXMLgrouped [centre] \midaligned \defineXMLgrouped [em] \em \defineXMLsingular [br] [nr=1] {\blank[\XMLop{nr}*medium]} \showstruts \showframe \starttext start of 'normal' \CONTEXT\ text \underbar{This} is {\em left} aligned \blank[medium] \rightaligned{\underbar{This} is {\em right} aligned} \blank[medium] \midaligned{\underbar{This} is {\em centre} aligned} end of 'normal' \CONTEXT\ text - starting xml ... \startXMLdata

This is left aligned

This is centre aligned

This is centre aligned

This is right aligned

\stopXMLdata \blank[medium] finished xml - back in 'normal' \CONTEXT\ text \stoptext NOTICE This e-mail and any attachments are intended for the addressee(s) only and may be confidential. They may contain legally privileged or copyright material. You should not read, copy, use or disclose them without authorisation. If you are not the intended recipient please contact the sender as soon as possible by return e-mail and then please delete both messages. This notice should not be removed. --=_alternative 001C9153CA257204_= Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit
Hi everyone,

I am attempting to map some XML into ConTeXt as described in the manual "XML in ConTeXt".  Essentially we have a bunch of tagged text (the XML "loosely" based on some of the  XHTML tags) from which we want to produce PDF letters for dispatch (via email, post etc).

I am having particular problems implementing the following commands: -
        \underbar, \underbars, \overstrike, \overstrikes, \low, \high and \lohi

I was expecting that they would all easily be defined using the \defineXMLgrouped [name] {command} element mapping. There is probably something very simple that I have not setup correctly since I am sure that this has been attempted before and would appreciate pointers as to where I am going wrong.

The following attempts at mapping element <u> to \underbar illustrates my problem which also seems largely applicable to the <strike>, <sub> and <sup> mapping: -

1.  This def of <u> does nothing ...
\defineXMLgrouped [u] \underbar

2.  This def of <u> also does nothing ...
\defineXMLgrouped [u] {\groupedcommand{\underbar}{}}

3. This def of <u> underlines the 1st character only ...
\defineXMLenvironment [u] {\bgroup\underbar} {\egroup}

4. In the mailing list, there is a suggestion that  \underbar does not allow line-breaking, so I also tried the following.  This def of <u> "works" partially, in that it does underline, however it causes havoc with alignment - everything seems to shift over to the right about 4cm ...

\defineXMLenvironment [u] \startul \stopul
\definetextbackground[ul]
  [location=text,alternative=1,background=,frame=off]

\definestartstop[ul]
    [before={\starttextbackground[ul] },
        after={\stoptextbackground\ }]


Below is a sample  .tex file that I have been playing with: -

\usemodule        [contml]
\autoXMLnamespace [context]

% Attempts at defining a mapping for <u>: -
% This def of <u> does nothing ...
%\defineXMLgrouped [u] \underbar
% This def of <u> does nothing ...
%\defineXMLgrouped [u] {\groupedcommand{\underbar}{}}
% This def of <u> underlines the 1st character only ...
%\defineXMLenvironment [u] {\bgroup\underbar} {\egroup}
%
% This def of <u> "works" partially, in that it does underline, however it
% causes havoc with alignment - everything seems to shift over to the right
% about 4cm ...

\defineXMLenvironment [u] \startul \stopul
\definetextbackground[ul]
  [location=text,alternative=1,background=,frame=off]

\definestartstop[ul]
    [before={\starttextbackground[ul] },
    %    after={\stoptextbackground\fixedspaces}]
        after={\stoptextbackground\ }]

% Other mappings
\defineXMLgrouped [right]  \rightaligned
\defineXMLgrouped [centre] \midaligned
\defineXMLgrouped [em] \em
\defineXMLsingular [br] [nr=1]
    {\blank[\XMLop{nr}*medium]}

\showstruts \showframe

\starttext

start of 'normal' \CONTEXT\ text

\underbar{This} is {\em left} aligned
\blank[medium]
\rightaligned{\underbar{This} is {\em right} aligned}
\blank[medium]
\midaligned{\underbar{This} is {\em centre} aligned}

end of 'normal' \CONTEXT\ text - starting xml ...

\startXMLdata

<p>This is <em>left</em> aligned</p>

<p><centre><u>This</u> is <em>centre</em> aligned</centre></p>

<p><centre>This is <em>centre</em> aligned</centre></p>

<p><right>This is <em>right</em> aligned</right></p>

\stopXMLdata
\blank[medium]
finished xml - back in 'normal' \CONTEXT\ text
\stoptext


NOTICE

This e-mail and any attachments are intended for the addressee(s) only and may be confidential. They may contain legally privileged or copyright material. You should not read, copy, use or disclose them without authorisation. If you are not the intended recipient please contact the sender as soon as possible by return e-mail and then please delete both messages. This notice should not be removed.

--=_alternative 001C9153CA257204_=-- --===============0041077510== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context --===============0041077510==--