pagebreak before element identified with attribute

Post here questions and problems related to editing and publishing DITA content.
dangler
Posts: 1
Joined: Tue Oct 09, 2018 2:15 pm

pagebreak before element identified with attribute

Post by dangler »

Hi,

I am trying to identify an element by attribute and then add a pagebreak before. Right now I can identify the element and the pagebreak works but the element is removed. I managed to copy the content with <xsl:copy-of but the formatting is not applied. Is there some option to add the formatting by calling the title formatting? I already tried to create a new <title> element inside the template node but nothing is created when doing this.

The following example results in a pagebreak but without the formatting of the title:

Code: Select all

<xsl:template match="//title[@formatting='pageBreakBefore']">
<fo:block page-break-before="always"/>
<xsl:copy-of select="node()"/>
</xsl:template>

Code: Select all

  <title formatting="pageBreakBefore">Some Title</title>
Thanks a lot in advance!
Radu
Posts: 9051
Joined: Fri Jul 09, 2004 5:18 pm

Re: pagebreak before element identified with attribute

Post by Radu »

Hi,

The XSLT is applied on a DITA document and it produces XSL-FO output.
Using "xsl:copy-of" means that the DITA <title> element will be copied to the output XSL-FO as a <title> element instead of being processed as an XSL-FO element.
My recommendation:

Code: Select all

<xsl:template match="title[@formatting='pageBreakBefore']">
<fo:block page-break-before="always"/>
<xsl:next-match/>
</xsl:template>
That <xsl:next-match/> means to continue the processing by applying the default XSLT template which matches the title element.
Using <xsl:apply-imports/> instead of xsl:next-match might also work.

An alternative is to specify the page break using a processing instruction:

https://github.com/dita-community/org.d ... page-break

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Quick van Rijt
Posts: 11
Joined: Tue Aug 23, 2016 6:18 pm

Re: pagebreak before element identified with attribute

Post by Quick van Rijt »

You tagging a title with an attribute to trigger a page-break.
If your goal is to start selected topics of interest on a new page, check-out the following plugin:

https://github.com/dita-community/org.d ... page-break

I just submitted a solution to use:

Code: Select all


<prolog>
<?pagebreak?>
</prolog>
Regards
Quick van Rijt
Professional user of Oxygen XML and DITA OT
Post Reply