Using conditions and act only on correct match

Hi again,

I'm trying to add an element if a certain element contains a certain value.

I came up with this:

        <p:variable name="allowed-signatures" select="('ET_383')" />

        <p:if test="xhtml:div[@data-custom-style='Signatur' and xhtml:p = $allowed-titles]">
            <p:variable name="image" select="//xhtml:div[@data-custom-style='Signatur']/xhtml:p[. = $allowed-signatures]/text()" />
            <p:insert match="//xhtml:div[@data-custom-style='Signatur']" position="after">
                <p:with-input port="insertion">
                    <p:inline exclude-inline-prefixes="#all" xmlns="http://www.w3.org/1999/xhtml">
                        <img src="{$image}" />
                    </p:inline>
                </p:with-input>
            </p:insert>
        </p:if>

The problem with this is that it will insert the img element even after elements where the condition does not hold. How can I address the current context when using p:insert?

Best,
Denis

Received on Thursday, 21 November 2024 15:41:18 UTC