From: Richard Gabriel <rgabriel@kerio.com>
Subject: Re: ConTeXt, XML, multiple attributes evaluation
Date: Tue, 29 Nov 2005 12:02:19 +0100 [thread overview]
Message-ID: <20051129110219.c48dfb56@mx1.kerio.com> (raw)
In-Reply-To: <438C24CE.2000200@wxs.nl>
[-- Attachment #1.1: Type: text/plain, Size: 3058 bytes --]
Thanks, Hans! One's still learning...
R.
_____
From: Hans Hagen [mailto:pragma@wxs.nl]
To: mailing list for ConTeXt users [mailto:ntg-context@ntg.nl]
Cc: graumann@its.caltech.edu
Sent: Tue, 29 Nov 2005 10:52:14 +0100
Subject: Re: [NTG-context] ConTeXt, XML, multiple attributes evaluation
Richard Gabriel wrote:
> Hello Johannes,
>
> I consider your first \XMLifequalelse command a bit strange. This
> command is intented to be used if you want to convert the attribute
> values into something else (e.g. "yes" into "packed").
> If you need the unmodified parameter value, simply use \XMLpar.
> So e.g.:
>
> \startitemize[ \XMLpar{list}{setup}{},
> \XMLifequalelse{list}{packed}{yes}{packed}{unpacked} ]
>
> Of course "setup" should be a required attribute of <list> (in your
> DTD), otherwise it would lead to something like \startitemize[,packed]
> which obviously wouldn't work at all.
> If it's not the case, I'd use \doifXMLparelse:
>
> \doifXMLparelse{list}{setup}{%
> \startitemize[ \XMLpar{list}{setup}{},
> \XMLifequalelse{list}{packed}{yes}{packed}{unpacked} ]%
> }{%
> \startitemize[1, \XMLifequalelse{list}{packed}{yes}{packed}{unpacked} ]
> }
>
>
> -Richard
>
>
> ------------------------------------------------------------------------
> *From:* Johannes Graumann [mailto:graumann@caltech.edu]
> *To:* ntg-context@ntg.nl
> *Sent:* Tue, 29 Nov 2005 05:30:25 +0100
> *Subject:* [NTG-context] ConTeXt, XML, multiple attributes evaluation
>
> Hello again,
>
> Another one:
> I'm trying to expand
> >\defineXMLenvironment [list]%
> > {%
> > \expanded{%
> > \startitemize%
> > [%
> > \XMLifequalelse{list}{packed}{yes}{packed}{unpacked}%
> > ]%
> > }%
> > }%
> > {\stopitemize}
>
> which can deal with things like
> ><list packed="yes">
> > <item>
> > </item>
> ></list>
>
> To something able to deal with multiple attributes (a "setup"
> statement for
> now):
> ><list packed="yes" setup="n">
> > <item>
> > </item>
> ></list>
>
> I have tryed multiple incarnations of
> >\defineXMLenvironment [list]%
> > {%
> > \expanded{%
> > \startitemize%
> > [%
> > \XMLifequalelse{list}{setup}{n}{n}{},%
> > \XMLifequalelse{list}{packed}{yes}{packed}{unpacked}%
> > ]%
> > }%
> > }%
> > {\stopitemize}
>
> but this doesn't work ...
>
> Can anybody give me any pointers here?
>
a convenient way is to use the remapper:
\mapXMLvalue {list:packed} {yes} {packed}
\mapXMLvalue {list:packed} {no} {unpacked}
and then:
\defineXMLenvironment
[list]
[packed=no]
{\startitemize[\XMLval{list:packed}{\XMLop{packed}}{}]}
{\stopitemize}
no fuzzy testing involved, just expansion (fast and clean)
Hans
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
[-- Attachment #1.2: Type: text/html, Size: 4292 bytes --]
[-- Attachment #2: Type: text/plain, Size: 139 bytes --]
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
next prev parent reply other threads:[~2005-11-29 11:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-29 4:30 Johannes Graumann
2005-11-29 7:34 ` Richard Gabriel
2005-11-29 9:52 ` Hans Hagen
2005-11-29 11:02 ` Richard Gabriel [this message]
2005-11-29 7:37 ` Taco Hoekwater
2005-11-29 19:58 ` Johannes Graumann
2005-11-29 21:15 ` Hans Hagen
2005-11-30 1:36 ` Johannes Graumann
2005-11-30 8:36 ` Hans Hagen
2005-11-30 20:07 ` Johannes Graumann
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=20051129110219.c48dfb56@mx1.kerio.com \
--to=rgabriel@kerio.com \
--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).