topicgroup or topicset -- no headers/footers

cud
Posts: 41
Joined: Fri Oct 06, 2017 5:22 pm

topicgroup or topicset -- no headers/footers

Post by cud » Sun Nov 10, 2019 2:14 pm

Hi all...

I need to generate a PDF from a map that contains arbitrary subsets of topicref elements from another map. Please do not argue with that requirement... It just is what it is.

If I use <topicref conref="ID_OF_SOME_TOPICREF"/> then I get a good PDF. But this is tedious because I would then need many of these conrefs to get all the map content I want. Also, if I change the source map, then I might need to change the map with conrefs. I want to avoid this.

I tried wrapping sections of the source map in either topicgroup or topicset. For the topicgroup experiment I then use
<topicgroup conref="ID_OF_SOME_TOPICGROUP"/>

For the topicset experiment I use
<topicsetref href="ID_OF_SOME_TOPICSET"/>

In both of those cases, the resulting pages do not include headers/footers. I'm guessing that the CSS processor catches these elements as wrappers of topicref elements, and does something different with them. Is there a CSS statement I can make to have it recognize the topicset children the way I need them, so it will then add in the headers/footers? I don't even know where to start.

cud
Posts: 41
Joined: Fri Oct 06, 2017 5:22 pm

Re: topicgroup or topicset -- no headers/footers

Post by cud » Mon Nov 11, 2019 3:08 pm

I'm guessing you can narrow it down to this...

In the merged.xml file within the <opentopic:map> element you see that the topicset or topicgroup is set with is-chapter="true". Those should probably be set to false. Or perhaps they should not be in this listing? Maybe their child topicrefs should be here?

Then after </opentopic:map> you get the actual topics. Note that none of them are wrapped in topicgroup or topicset at this point in the file.

A normal topicref that was NOT a child of a topicgroup or topicset gets the following attributes:
break-before="true"
is-chapter="true"
oxy:topicref-class="- map/topicref "

OTOH, a topicref that WAS a child of a group or set does not get these attrubutes. I'm trying to add these attributes in a custom XSL for the transform, but I don't know the namespace spec for "oxy"... So I can't add in the topicref-class. I'm afraid that's holding me up. But I'm thinking that if I add something like the following to my custom xsl, then it would set the topics correctly before generating the final PDF??? Or am I barking up the wrong tree?

<xsl:template match="topic">
<xsl:if test="name(parent::*)!='topic'">
<xsl:copy>
<xsl:attribute name="is-chapter">true</xsl:attribute>
<xsl:attribute name="break-before">true</xsl:attribute>
<!-- Commented out because I don't know the oxy namespace
<xsl:attribute name="oxy:topicref-class">map/topicref</xsl:attribute>
-->
<xsl:attribute name="class"><xsl:value-of select="@class"/></xsl:attribute>
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
<xsl:attribute name="oid"><xsl:value-of select="@oid"/></xsl:attribute>
<!-- Commented out because I don't know the nd namespace
<xsl:attribute name="nd:nd-id"><xsl:value-of select="@nd:nd-id"/></xsl:attribute>
-->
</xsl:copy>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>


Anyway, this moves in the right direction... I get the headers and footers. BUT, each chapter has a blank first page (I have a special layout for a chapter first page). It seems to start the chapter content on page 2 of the chapter. Is that because I don't include the oxy:topicref-class? (As a side note, I tried setting break-before=false, but it still makes a blank chapter first page.)


Is there a CSS setting that turns OFF is-chapter for topicgroup or topicset, and another one that turns ON is-chapter for any child of these wrapper elements? That might make it so I don't need to muck about with the custom XSLT.

julien_lacour
Posts: 10
Joined: Wed Oct 16, 2019 3:47 pm

Re: topicgroup or topicset -- no headers/footers

Post by julien_lacour » Mon Nov 11, 2019 5:04 pm

Hello,

There is an issue on our side, as you indicated the topicgroup element should be ignored by the process in this case.
We are correcting this asap and get back to you with a link to dita-publishing-engine snapshot version to generate correctly your output.

Moreover, the only behavior modified is the one using <topicgroup> as <topicset> introduces a hierarchy in the map so in this case it is normal.
https://www.oxygenxml.com/dita/1.3/spec ... icset.html

Can you please write an email to support@oxygenxml.com?
I will forward the download link when it will be done.

Regards,
Julien

cud
Posts: 41
Joined: Fri Oct 06, 2017 5:22 pm

Re: topicgroup or topicset -- no headers/footers

Post by cud » Thu Nov 14, 2019 1:03 pm

Thanks Julien... It works like a charm.

I don't understand your statement, "Moreover, the only behavior modified is the one using <topicgroup> as <topicset> introduces a hierarchy in the map so in this case it is normal." With your patch I see that if I use topicset/topicsetref, then I also get headers and footers in the PDF. This is what I would expect.

Finally, please ignore the XSLT experiment that I posted here. It was definitely not the right approach to this.

julien_lacour
Posts: 10
Joined: Wed Oct 16, 2019 3:47 pm

Re: topicgroup or topicset -- no headers/footers

Post by julien_lacour » Thu Nov 14, 2019 1:32 pm

Hello,

The part with <topicset> was related to 'is-chapter' propagation inside the output only:
When using <topicgroup> the child <topicref> will receive the correct attribute as if the parent did not exists.
When using <topicset>, all children will remain without attribute as the parent receive them => this was my explanation with hierarchy.

Regards,
Julien

cud
Posts: 41
Joined: Fri Oct 06, 2017 5:22 pm

Re: topicgroup or topicset -- no headers/footers

Post by cud » Thu Nov 14, 2019 3:34 pm

In that case, I would argue that it is not necessarily correct to treat topicset this way. The hierarchy is functional for reuse, but it is not necessarily semantic. I guess the best approach would be to include a way to modify this behavior in the custom CSS. But if you don't offer that, I would argue that the best default behavior would be to treat topicset the way you treat topicgroup.

My two cent's worth of opinion... I can use topicgroup perfectly well to achieve what I want.

julien_lacour
Posts: 10
Joined: Wed Oct 16, 2019 3:47 pm

Re: topicgroup or topicset -- no headers/footers

Post by julien_lacour » Thu Nov 14, 2019 6:11 pm

The idea is this is semantic, this is why I linked the topics from DITA documentation.
In the topicgroup documentation it's indicated "The <topicgroup> element groups <topicref> elements for common treatment without affecting the structural hierarchy of the map, as opposed to nesting <topicref> elements, which does imply a structural hierarchy."
On the other hand, in the topicset documentation you will find "A <topicset> is similar to a source file that contains nested topics, in that the combination of topics constitutes a complete self-contained unit."

I hope my explanation is cleared enough.
Regards,
Julien

Post Reply