concatenating attribute values in XML
Dear list, I have the following definition: \startxmlsetups xml:image:sidebyside \blank\startalign[center] \dontleavehmode \externalfigure[\xmlattribute{#1}{./p/img}{src}] [width=.5\textwidth] %~ \xmlconcat{#1}{./p/img}{ } \stopalign\blank \stopxmlsetups How can I define the external figure so I concatenate the image file names in the code above? I mean, \xmlconcat is great, but I don’t see how I could make it work to get values from the src attribute. Many thanks for your help, Pablo -- http://www.ousia.tk
On 8/6/2017 11:37 AM, Pablo Rodriguez wrote:
Dear list,
I have the following definition:
\startxmlsetups xml:image:sidebyside \blank\startalign[center] \dontleavehmode \externalfigure[\xmlattribute{#1}{./p/img}{src}] [width=.5\textwidth] %~ \xmlconcat{#1}{./p/img}{ } \stopalign\blank \stopxmlsetups
How can I define the external figure so I concatenate the image file names in the code above?
I mean, \xmlconcat is great, but I don’t see how I could make it work to get values from the src attribute. why do you want to pass multiple names to \externalfigure
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 08/06/2017 12:05 PM, Hans Hagen wrote:
On 8/6/2017 11:37 AM, Pablo Rodriguez wrote:
[...] How can I define the external figure so I concatenate the image file names in the code above?
I mean, \xmlconcat is great, but I don’t see how I could make it work to get values from the src attribute.
why do you want to pass multiple names to \externalfigure
Many thanks for your reply, Hans. My code was wrong, I need two external figures, not one. I only get the same image repeated twice. I don’t know how to solve it. This is what I have in the XML file: <div class="sidebyside"> <p><img src="img/first-image.png" /> <img src="img/second-image.png" /></p> </div> This is what I tried in the environment file: \startxmlsetups xml:sidebyside \blank\startalign[center] \dontleavehmode \externalfigure[\xmlattribute{#1}{./p/img}{src}] [width=.5\textwidth] \externalfigure[\xmlattribute{#1}{./p/img}{src}] [width=.5\textwidth] \stopalign\blank \stopxmlsetups And this is what I need in pure ConTeXt: \blank\startalign[center] \dontleavehmode \externalfigure[img/first-image.png][width=.5\textwidth] \externalfigure[img/second-image.png][width=.5\textwidth] \stopalign\blank How could I achieve the second? (Concatenation is the only thing that comes to my mind.) Many thanks for your help, Pablo -- http://www.ousia.tk
On 08/06/2017 10:11 PM, Pablo Rodriguez wrote:
[...] This is what I have in the XML file:
<div class="sidebyside"> <p><img src="img/first-image.png" /> <img src="img/second-image.png" /></p> </div>
Sorry, Hans. Today I realize I was saying nonsense. I solved it with: \xmlsetsetup{\xmldocument} {[contains(@class,'sidebyside')]/p} {xml:sidebyside} \xmlsetsetup{\xmldocument} {[contains(@class,'sidebyside')]/p/img} {xml:image:sidebyside} \startxmlsetups xml:sidebyside \blank\startalign[center] \dontleavehmode \xmlflush{#1} \stopalign\blank \stopxmlsetups \startxmlsetups xml:image:sidebyside \externalfigure[\xmlatt{#1}{src}][width=.495\textwidth] \stopxmlsetups Sorry for the noise, Pablo -- http://www.ousia.tk
participants (2)
-
Hans Hagen
-
Pablo Rodriguez