-1

Input Dita file

If any topic has p/@outputclass="kingbreak", we want to create footer page number with horizontal, I tried with xsl:number/ but it is picking disorder page number, Please help

<?xml version="1.0" encoding="utf-8"?>
<dit xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot">
    <topic>
        <title/>
        <body>
            <p>content here</p>
            <p>content here <ph/>content here</p>
            <p outputclass="kingbreak"/>
        </body>
    </topic>
    <topic>
        <title>SELF title</title>
        <body>
            <p>body content</p>
        </body>
        <topic>
            <title>content here</title>
            <body>
                <p>
                    <b>content here</b>
                </p>
            </body>
            <topic>
                <title>content here</title>
                <body>
                    <section>
                        <p>contenet here</p>
                        <p outputclass="kingbreak"/>
                    </section>
                </body>
            </topic>
            <topic>
                <title>content here</title>
                <body>
                    <section>
                        <p>content here</p>
                        <p outputclass="kingbreak"/>
                    </section>
                </body>
            </topic>
            <topic>
                <title>title content here</title>
                <body>
                    <p>content here</p>
                    <p outputclass="kingbreak"/>
                </body>
            </topic>
            <topic>
                <title>content here</title>
                <body>
                    <section>
                        <p>content here</p>
                        <p outputclass="kingbreak"/>
                    </section>
                </body>
            </topic>
    </topic>
    </topic>
</dit>

XSLT I tried with below xslt, it is generating random page number

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    version="2.0">
    <xsl:template match="node()|@*">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>
    <xsl:template match="p[contains(@outputclass, 'kingbreak')]">
            <xsl:number/>
            <hr style="border-top:1.5pt solid #000000;" />
    </xsl:template>
    <xsl:stylesheet/>

Please help on this, thanks in advance

Kita Ansari
  • 121
  • 7
  • Please show us the exact output structure and the exact page numbers and positions in the output structure where you want to generate them. Just throwing in `xsl:number` certainly can't do the right thing magically, but it has various attribute like `count` and `from` and `level` that can do some "magic". – Martin Honnen Jun 17 '21 at 09:38
  • With nested `topic`s perhaps `` makes some sense. But you really need to show the output structure and number structure you want to generate. – Martin Honnen Jun 17 '21 at 10:00
  • See below my current output, it's picking only page number 2 – Kita Ansari Jun 17 '21 at 10:35
  • content here

    contenet here

    2

    content here

    content here

    2

    – Kita Ansari Jun 17 '21 at 10:42
  • It's very long output but I am giving only occurrences code. In
    2
    is our page number, later I will do style right now I want correct page number, Please help me, I unable to get.
    – Kita Ansari Jun 17 '21 at 10:44
  • Number structure should be like 1,2,3,4,...... – Kita Ansari Jun 17 '21 at 10:58

1 Answers1

1

Try whether <xsl:number level="any" count="p[contains(@outputclass, 'kingbreak')]"/> gives you the wanted sequence of numbers.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110