I want to keep two rows together, without page break happening between them. My xslt script is as follow:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" exclude-result-prefixes="xs" xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns:xsl=http://www.w3.org/1999/XSL/Transform>
<xsl:template priority="101" match="row[.//entry[@nameend='c2']/ph]">
<xsl:call-template name="row-keep-with-next"/>
</xsl:template>
<xsl:template name="row-keep-with-next">
<xsl:variable name="row" as="node()">
<topic class="- topic/tbody ">
<xsl:copy >
<xsl:sequence select="@* except @outputclass"/>
<xsl:attribute name="outputclass" select="string-join(('keep-with-next', tokenize(@outputclass, '\s+')), ' ')"/>
<xsl:sequence select="node()"/>
</xsl:copy>
</topic>
</xsl:variable>
<xsl:apply-templates select="$row"/>
</xsl:template>
</xsl:stylesheet>
But I still see page break happening. My css is as follows:
@media print
{ *[outputclass~="keep-with-next"] { page-break-after: avoid; }
*[outputclass~="keep-with-previous"] { page-break-before: avoid; }
*[outputclass~="top-of-page"] { page-break-before: always; } }
This is the sample on which I am trying to test:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE dita
PUBLIC "-//OASIS//DTD DITA Composite//EN" "dtd/ditabase.dtd">
<dita><!-- topic/titlealts not supplied within topic/topic --><!-- topic/prolog not supplied within topic/topic --><reference xmlns:ditaarch=http://dita.oasis-open.org/architecture/2005/ id="parameters_top"><title>Parts</title>
<refbody outputclass="db.sect2"><section>
<table id="paratable" pgwide="1" outputclass="PTable"><title outputclass="db.title">Basic Config</title>
<tgroup cols="2" outputclass="ParametersTable"><colspec colnum="1" colname="c1" colwidth="2*"/><colspec colnum="2" colname="c2" colwidth="5*"/>
<thead outputclass="db.thead"><row outputclass="db.row"><entry outputclass="db.entry">Label</entry><entry outputclass="db.entry">Description</entry></row></thead>
<tbody outputclass="db.tbody">
<row outputclass="db.row"><entry outputclass="db.entry" namest="c1" nameend="c2" align="center"><ph outputclass="db.phrase"> P Type </ph></entry></row>
<row outputclass="db.row"><entry outputclass="db.entry"><ph outputclass="db.phrase">Phy</ph></entry><entry outputclass="db.entry"><p outputclass="db.para"><ph outputclass="db.phrase">Select the type of PHY.</ph></p></entry></row>
<row outputclass="db.row"><entry outputclass="db.entry"><ph outputclass="db.phrase">Speed</ph></entry><entry outputclass="db.entry"><p outputclass="db.para">Link speed </p></entry></row></tbody></table></section></refbody></reference></dita>
I am trying to avoid pagebreak after row with "P Type".