Dynamic filter for Webhelp output

Post here questions and problems related to editing and publishing DITA content.
Sergio_7
Posts: 16
Joined: Fri Sep 15, 2023 9:56 am

Dynamic filter for Webhelp output

Post by Sergio_7 »

Dear Oxygen Team,
I would like to incorporate a dynamic filter into our HTML Webhelp output that allows users to filter between the audience groups displayed. To do this, a small dropdown menu should be displayed where different audiences are assigned so that customers can select their audience group and see the appropriate text. Upon inquiry with AI Positron, there is a possibility to activate such a filter for standard target groups ‘expert’ and ‘beginner’ as audiences by assigning:
  • 'webhelp.filtering.enabled`='yes'
  • `webhelp.filtering.attributes'='audience'
Unfortunatelly, I cannot find such parameters in Oxygen v28.
Can you help me with this?
Thank you very much and best regards,
Sergio
julien_lacour
Posts: 760
Joined: Wed Oct 16, 2019 3:47 pm

Re: Dynamic filter for Webhelp output

Post by julien_lacour »

Hello,

Unfortunately AI Positron answer is inaccurate: there's no "webhelp.filtering" parameters available at all. Be aware that AI-based information isn't always correct.

For your use-case you can implement this flow:
  1. Use profiling attributes in your DITA content
  2. Declare the audiences in your DITAVAL file using passtrough action:

    Code: Select all

    <val>
        <prop action="passthrough" att="audience" val="novice"/>
        <prop action="passthrough" att="audience" val="expert"/>
    </val>
    
  3. The audiences will appear in the output as data-audience attributes
  4. Create a small JavaScript adding a dropdown allowing you to select the audience filter the content.
For more information you can check our user guide.

Regards,
Julien
Sergio_7
Posts: 16
Joined: Fri Sep 15, 2023 9:56 am

Re: Dynamic filter for Webhelp output

Post by Sergio_7 »

Hello Julien,
Thank you for your prompt reply. I have found another solution without the on-the-fly filter. Now I can publish my own audience (defined in ditaval) directly under the title using a small JS script. This works well for the HTML output of Webhelp, and even the translation for different xml:langs is embedded directly in the script.

EXAMPLE:

Code: Select all

<audience audience="it-admin">
image.png
My problem is the PDF output, which also extracts the target audience with xpath from the topic metadata and places it under the title, but the translations are not included. So the original "audience="it-admin"" value remains on that place.

EXAMPLE:

Code: Select all

<audience audience="it-admin">
image.png

My question:
How can I manage the translations for audience="my-defined-audience" directly as a new string in the localization plugin?
I already use a localization plugin (different langs as "de-de"; "en-us" etc) for all standard strings. But these types of “strings” or “attributes” such as

Code: Select all

<audience audience="it-admin">
or

Code: Select all

 <section audience="owner">
are not part of the default "string-xx-xx" file and are not reflacted in the PDF output, even when new strings are added like

Code: Select all

<str name="audience.it-admin" js="true" php="false">IT Admin</str>
Thanks in advance!
You do not have the required permissions to view the files attached to this post.
julien_lacour
Posts: 760
Joined: Wed Oct 16, 2019 3:47 pm

Re: Dynamic filter for Webhelp output

Post by julien_lacour »

Hello,

Could you confirm you are using DITA Map PDF - based on HTML5 & CSS based scenarios? How did you integrate the small JS script in the PDF output?
Does your localization plugin both requires "com.oxygenxml.pdf.css" and "com.oxygenxml.webhelp.responsive" plugins? Both need to see the plugin in order to use its strings.

Regards,
Julien
Sergio_7
Posts: 16
Joined: Fri Sep 15, 2023 9:56 am

Re: Dynamic filter for Webhelp output / Audience for HTML/PDF output

Post by Sergio_7 »

Hi Julien,
1. I use my own PDF template based on HTML5 and CSS.
2. The JS is integrated for HTML output, not for PDF, as this is not possible.
3. Localization requires:
  • com.oxygenxml.webhelp.localization
  • com.oxygenxml.webhelp.responsive
BR
julien_lacour
Posts: 760
Joined: Wed Oct 16, 2019 3:47 pm

Re: Dynamic filter for Webhelp output

Post by julien_lacour »

Hi,

I wanted to make sure you were not trying to use JS in the PDF plugin too.
For PDF output you can reuse the string from the localization plugin if you generate the element displaying the audience using XSLT, you should be able to get the variable by calling the following template:

Code: Select all

<xsl:call-template name="getVariable">
    <xsl:with-param name="id" select="'audience.it-admin'"/>
</xsl:call-template>
Another variant is to customize the string directly in CSS using the :lang pseudo-class.

Regards,
Julien
Post Reply