Page 1 of 1

Image for WHR header from map/topichead/topicmeta/data/image

Posted: Thu Jun 12, 2025 6:03 pm
by GregWait
EDIT: Is there a simpler way to do this? Maybe take the href of the image with outputclass="header-img" and use that to set the value of webhelp.logo.image?

Thanks in advance for the help... My XSLT is a little rusty, and I'm sure there's something obvious I'm missing, but here's my issue...
I'm customizing a Webhelp Responsive plugin.
I need an image in my html page headers that changes for each map published, so I've placed an image in the map within a data element within the map's topicmeta element...

Code: Select all

<map>
    <title>Map Title</title>
    <topicmeta>
        <data><image outputclass="header-img" href="image.jpg" id="image_123456"/></data>
    </topicmeta>
Here's my XSLT (testing in commonComponentsExpander.xsl):

Code: Select all

<xsl:template match="whc:webhelp_logo" mode="copy_template">
        <xsl:variable name="headerImage" select="/map/topicmeta/data/image[@outputclass='header-img']/@href"/>
        <!-- If the image reference exists, insert an <img> tag -->
        <xsl:if test="$headerImage">
            <img src="{$headerImage}" alt="Header logo"/>
        </xsl:if>
        <xsl:if test="not($headerImage)"/>
    </xsl:template>
Again, thanks in advance for any help someone can provide.

Re: Image for WHR header from map/topichead/topicmeta/data/image

Posted: Mon Jun 16, 2025 2:19 pm
by InspectorSpacetime
Hi,

You can also set the logo image dynamically by using the ${xpath_eval} editor variable in the webhelp.logo.image transformation parameter:

Code: Select all

${xpath_eval(/map/topicmeta/data/image[@outputclass='header-img']/@href)}
Not sure it works in your use case, but thought I'd mention it..

Re: Image for WHR header from map/topichead/topicmeta/data/image

Posted: Mon Jun 16, 2025 3:31 pm
by julien_lacour
Hello,

I confirm InspectorSpacetime's solution works: you can directly use ${xpath_eval} editor variable for this use-case.
However, a limitation is that editor variables only work in Oxygen's transformation dialog.

Regards,
Julien

Re: Image for WHR header from map/topichead/topicmeta/data/image

Posted: Mon Jun 16, 2025 5:03 pm
by julien_lacour
Hello,

Another solution is to use an HTML fragment, this solutions works in Oxygen and using Oxygen Publishing Engine and is based on a publishing template: Dynamic Logo Template

Regards,
Julien

Re: Image for WHR header from map/topichead/topicmeta/data/image

Posted: Thu Jun 19, 2025 8:01 pm
by GregWait
Thanks for the responses. I ended up realizing that putting the image in topicmeta/data was complicating things and made the image the href of a keydef on the map. After that everything fell into place.
-G