Skip to content

Commit

Permalink
Pagenumbers done with CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
ottoville committed Apr 18, 2016
1 parent 6298bc3 commit e82f47b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
10 changes: 9 additions & 1 deletion docx2html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,15 @@
ul.outsidee { list-style-position:outside} ul.outsidee>li>p:first-child { text-indent:0 !important;display:block}
ul>li>p:not(:first-child) { text-indent:0 }
ul, li { margin:0;padding:0 } li p {} input[type="text"] {height:18px} input[type="checkbox"] { margin:0 } p {margin:0;position:relative}
article>div {display:block; margin-top:0.1cm;border-width:1px;border-style:solid;position:relative;}
article {
counter-reset: page;
}
article>div {
counter-increment: page;
display:block; margin-top:0.1cm;border-width:1px;border-style:solid;position:relative;}
article>div output.pagenumber::before {
content: counter(page);
}
article>div>header.even {
display:none;
}
Expand Down
6 changes: 1 addition & 5 deletions pages.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@
<xsl:call-template name="pages">
<xsl:with-param name="reldocument" select="$reldocument" />
<xsl:with-param name="themefile" select="$themefile" />
<!--<xsl:with-param name="pagenumber" select="position()" />-->
<xsl:with-param name="sectionselector" select="$sectionselector" />
<xsl:with-param name="selector" select="preceding-sibling::*|current()" />
<xsl:with-param name="defaultheader" select="$defaultheader" />
Expand All @@ -260,8 +259,6 @@
<xsl:call-template name="pages">
<xsl:with-param name="reldocument" select="$reldocument" />
<xsl:with-param name="themefile" select="$themefile" />
<!--<xsl:with-param name="pagenumber" select="count((preceding-sibling::*|current())[w:r/w:br[@w:type='page']]|(preceding-sibling::*|current())[last()])+1" />
-->
<xsl:with-param name="sectionselector" select="$sectionselector" />
<xsl:with-param name="selector" select="current()|./preceding-sibling::*[count(./preceding-sibling::*) &gt; count($prevsection/preceding-sibling::*)]" />
<xsl:with-param name="prevpage" select="(current()|./preceding-sibling::*[count(./preceding-sibling::*) &gt; count($prevsection/preceding-sibling::*)])[w:r/w:br[@w:type='page']][count(./preceding-sibling::*) &lt; count(current()/preceding-sibling::*)][last()]" />
Expand All @@ -280,8 +277,7 @@
<xsl:call-template name="pages">
<xsl:with-param name="reldocument" select="$reldocument" />
<xsl:with-param name="themefile" select="$themefile" />
<!--<xsl:with-param name="pagenumber" select="count((preceding-sibling::*|current())[w:r/w:br[@w:type='page']]|(preceding-sibling::*|current())[last()])+2" />
--><xsl:with-param name="sectionselector" select="$sectionselector" />
<xsl:with-param name="sectionselector" select="$sectionselector" />
<xsl:with-param name="selector" select="$prevsection/following-sibling::*" />
<xsl:with-param name="prevpage" select="($prevsection/following-sibling::*)[w:r/w:br[@w:type='page']][count(./preceding-sibling::*) &lt; count(current()/preceding-sibling::*)][last()]" />
<xsl:with-param name="defaultheader" select="$defaultheader" />
Expand Down
4 changes: 0 additions & 4 deletions paragraphs.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
<xsl:template name="paragraph" match="w:p[not(w:pPr/w:numPr)]">
<xsl:param name="reldocument" />
<xsl:param name="themefile"/>
<xsl:param name="pagenumber"/>
<xsl:param name="listintend"/>
<xsl:variable name="currentid" select="generate-id(current())" />
<xsl:variable name="class">
Expand All @@ -84,7 +83,6 @@
<xsl:with-param name="listintend" select="$listintend" />
<xsl:with-param name="reldocument" select="$reldocument" />
<xsl:with-param name="themefile" select="$themefile" />
<xsl:with-param name="pagenumber" select="$pagenumber" />
</xsl:apply-templates>
<xsl:if test='count(w:r)=0'>
<br />
Expand All @@ -94,7 +92,6 @@
<!-- List begin-->
<xsl:template match="w:p[w:pPr/w:numPr and not(./preceding-sibling::w:p[w:pPr/w:numPr/w:numId/@w:val=current()/w:pPr/w:numPr/w:numId/@w:val])]">
<xsl:param name="reldocument" />
<xsl:param name="pagenumber" />
<xsl:param name="listid" select="w:pPr/w:numPr/w:numId/@w:val" />
<xsl:param name="listlevel" select="w:pPr/w:numPr/w:ilvl/@w:val" />
<xsl:param name="relid" select="document(resolve-uri('numbering.xml',base-uri()))/w:numbering/w:num[@w:numId=$listid]/w:abstractNumId/@w:val" />
Expand Down Expand Up @@ -125,7 +122,6 @@
w:pPr/w:numPr/w:numId/@w:val=$listid)]">
<xsl:with-param name="reldocument" select="$reldocument" />
<xsl:with-param name="listintend" select="number($thislistintend)" />
<xsl:with-param name="pagenumber" select="$pagenumber" />
</xsl:apply-templates>
</ul>
</xsl:template>
Expand Down
5 changes: 1 addition & 4 deletions text.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
</xsl:template>
<xsl:template match="w:r[w:tab]">
<xsl:param name="reldocument" />
<xsl:param name="pagenumber" />
<xsl:variable name="prevtab" select="preceding-sibling::*[w:tab][1]" />
<xsl:variable name="tabstop" select="(number(document(resolve-uri('settings.xml',base-uri()))/w:settings/w:defaultTabStop/@w:val) div 20) * (4 div 3) "/>
<div>
Expand All @@ -71,7 +70,6 @@
<xsl:apply-templates select="./preceding-sibling::w:r[(w:fldChar[@w:fldCharType='begin'] or
(not(w:fldChar|w:instrText) and not(./preceding-sibling::w:r[w:fldChar][1]/w:fldChar/@w:fldCharType='separate')))]">
<xsl:with-param name="reldocument" select="$reldocument" />
<xsl:with-param name="pagenumber" select="$pagenumber" />
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
Expand Down Expand Up @@ -127,7 +125,6 @@
</xsl:template>
<xsl:template match="w:r[w:fldChar[@w:fldCharType='begin']]">
<xsl:param name="reldocument" />
<xsl:param name="pagenumber" />
<xsl:variable name="fieldtype" select="substring-before(concat(normalize-space(./following-sibling::w:r[1]/w:instrText),' '),' ')" />
<xsl:variable name="end" select="./following-sibling::w:r[w:fldChar/@w:fldCharType='end'][1]" />
<xsl:variable name="startid" select="generate-id(./following-sibling::w:r[w:fldChar/@w:fldCharType='separate'][1])" />
Expand All @@ -140,7 +137,7 @@
<output><xsl:value-of select="$text"/></output>
</xsl:when>
<xsl:when test="$fieldtype='PAGE'">
<output><xsl:value-of select="$pagenumber"/></output>
<output><xsl:attribute name="class" select="'pagenumber'"/></output>
</xsl:when>
<xsl:when test="$fieldtype='MACROBUTTON'">
<script></script>
Expand Down

0 comments on commit e82f47b

Please sign in to comment.