ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* concatenating attribute values in XML
@ 2017-08-06  9:37 Pablo Rodriguez
  2017-08-06 10:05 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Pablo Rodriguez @ 2017-08-06  9:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: concatenating attribute values in XML
  2017-08-06  9:37 concatenating attribute values in XML Pablo Rodriguez
@ 2017-08-06 10:05 ` Hans Hagen
  2017-08-06 20:11   ` Pablo Rodriguez
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2017-08-06 10:05 UTC (permalink / raw)
  To: ntg-context

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: concatenating attribute values in XML
  2017-08-06 10:05 ` Hans Hagen
@ 2017-08-06 20:11   ` Pablo Rodriguez
  2017-08-07 19:04     ` Pablo Rodriguez
  0 siblings, 1 reply; 4+ messages in thread
From: Pablo Rodriguez @ 2017-08-06 20:11 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: concatenating attribute values in XML
  2017-08-06 20:11   ` Pablo Rodriguez
@ 2017-08-07 19:04     ` Pablo Rodriguez
  0 siblings, 0 replies; 4+ messages in thread
From: Pablo Rodriguez @ 2017-08-07 19:04 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-07 19:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-06  9:37 concatenating attribute values in XML Pablo Rodriguez
2017-08-06 10:05 ` Hans Hagen
2017-08-06 20:11   ` Pablo Rodriguez
2017-08-07 19:04     ` Pablo Rodriguez

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).