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