[Libreoffice-bugs] [Bug 130599] New: Help content XSLT: add ability to override headings when embedding sections

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Tue Feb 11 20:03:11 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=130599

            Bug ID: 130599
           Summary: Help content XSLT: add ability to override headings
                    when embedding sections
           Product: LibreOffice
           Version: 7.0.0.0.alpha0+ Master
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: medium
         Component: Documentation
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: ilmari.lauhakangas at libreoffice.org
                CC: olivier.hallot at libreoffice.org

When creating a page that describes a menu, it is often handy to use <embed>
elements to include sections of content. The template for including headings in
embedded mode shifts heading levels with a "+ 1", so multiple h1 elements would
be avoided. However, sometimes this results in a rendered menu item list mixing
h2 and h3, when the desired result would be all h2 headings.

I figured it would be nice to be able to force a certain heading level for all
of the embedded headings. With something like

<embed href="blabla" overrideheadings="h2"/>

I ran into a wall, when trying to tunnel the parameter value to the final
apply-templates. A hardcoded solution by creating a mode="overrideheadings" is
possible (I tried it and it worked), but it would be nice to be able to pass
values to the override.

I am able to pass the value up to this point, <xsl:template
name="insertembed">:
https://opengrok.libreoffice.org/xref/help/help3xsl/online_transform.xsl#1069

As the template is applied to the headings indirectly - the direct applying
concerns <section> - I am not able to pass the parameter value to them. I mean
I tried an xsl:with-param inside the xsl:apply-templates in insertembed, but
the parameter is missing in action when it comes to the headings.

Heading templates are here, <xsl:template match="h1 | h2 | h3 | h4 | h5 | h6">:
https://opengrok.libreoffice.org/xref/help/help3xsl/online_transform.xsl#752

After doing some reading, apparently XSLT 2.0 would have a thing called tunnel
parameters, which would apparently be the Holy Grail for me:
https://www.w3.org/TR/xslt20/#tunnel-params

To be clear, this will not deliver the parameter value to the heading code
path:
<xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded">
    <xsl:with-param name="overrideheading" select="$overrideheading" />
</xsl:apply-templates>

To start the journey, I use this:
<!-- EMBED -->
<xsl:template match="embed">
<xsl:param name="overrideheading"/>
    <xsl:call-template name="resolveembed">
                <xsl:with-param name="overrideheading"
select="@overrideheading" />
        </xsl:call-template>
</xsl:template>

Then hand the param over from resolveembed to insertembed.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200211/388bf65f/attachment.htm>


More information about the Libreoffice-bugs mailing list