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

Here should go questions about transforming XML with XSLT and FOP.
GregWait
Posts: 12
Joined: Thu Apr 21, 2016 8:49 pm

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

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