How to add author information in generated webhelp

Post here questions and problems related to editing and publishing DITA content.
catherine
Posts: 158
Joined: Fri Nov 10, 2017 8:16 am

How to add author information in generated webhelp

Post by catherine »

Hi,
I found this page has author information (including author name, date and time) under the topic title.
https://blog.oxygenxml.com/topics/all_a ... _ons.html

"Contributed by: Radu Coravu on 2020-01-18"

How we can achieve this by Oxygen XML Editor.
Thanks.

Catherine
Best Regards
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to add author information in generated webhelp

Post by Radu »

Hi Catherine,

The first side to this is to add the author name and modification time to the DITA topic when I create it:

Code: Select all

topic id="welcome">
    <title>Welcome to the <ph keyref="oxygen"/> Blog !</title>
    <prolog>
        <author>Radu Coravu</author>
        <copyright>
            <copyryear year="2020"/>
            <copyrholder>Syncro Soft</copyrholder>
        </copyright>
        <critdates>
            <created date="2020-01-14"/>
        </critdates>
For the Oxygen XML Blog I have a Schematron schema which reminds me to do that and a quick fix to quickly add this information to a newly created topic:

https://github.com/oxygenxml/blog/blob/ ... /rules.sch

Now for displaying this information in the WebHelp output, I'm using a publishing template which you can download from here, it's a zip file:
https://github.com/oxygenxml/blog/tree/ ... publishing

I pass a reference to this publishing template as a parameter to the WebHelp Responsive transformation:

https://github.com/oxygenxml/blog/blob/ ... roject.xml

More about publishing templates:
https://www.oxygenxml.com/doc/versions/ ... tents.html

Inside the "Oxygen XML Blog WebHelp Template.opt" from the zip I add a custom XSLT extension:

Code: Select all

<extension file="xslt/prolog-show.xsl" id="com.oxygenxml.webhelp.xsl.dita2webhelp"/>
which matches the DITA prolog element and generates an HTML <div> from it:

Code: Select all

<xsl:template match="*[contains(@class, ' topic/prolog ')]">
        <div style="width:100%; text-align: right; font-style:italic; color:gray;">Contributed by: <xsl:value-of select="*[contains(@class, ' topic/author ')]"/>
            <xsl:if test="exists(.//*[contains(@class, ' topic/created ')]/@date)">
                on <xsl:value-of select=".//*[contains(@class, ' topic/created ')]/@date"/>    
            </xsl:if>
            </div>
    </xsl:template>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
catherine
Posts: 158
Joined: Fri Nov 10, 2017 8:16 am

Re: How to add author information in generated webhelp

Post by catherine »

Thanks so much, Radu. :D
We will try it.
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: How to add author information in generated webhelp

Post by chrispitude »

Hi catherine,

I recall there is also an Oxygen plugin that automates the creation/updating of this metadata:

https://github.com/oxygenxml/oxygen-dita-prolog-updater
Post Reply