[xsl] Duplicate output for nested list Help

Subject: [xsl] Duplicate output for nested list Help
From: "Edwardson Larry" <Larry.Edwardson@xxxxxxxxxxxxxxx>
Date: Mon, 15 Jul 2013 16:06:13 +1000
This is the XML:

Code:

<Condition>

    <ol>

        <li><strong>Duty of Care:</strong> The [Tenancy Lookup] has the
responsibility for a duty of care, for the land. This duty of care
includes taking al reasonable steps to do the following in relation to
the land:-

            <ol style=3D"list-style-type: lower-alpha">

                <li>avoid causing or contributing to land salinity that
-

                    <ol style=3D"list-style-type: lower-roman">

                        <li>reduces its productivity; or</li>

                        <li>damages any other land;</li>

                    </ol>

                </li>

            </ol>

        </li>

    </ol>

</Condition>

This is the XSLT:

Code:

<xsl:template match=3D"ol">

=20

        <!-- Template parameter that specifies level of indentation. Set
to 1 by default - if not specified. -->

        <xsl:param name=3D"levelNumber">1</xsl:param>

        <xsl:param name=3D"paragraphDepth"/>

        <xsl:param name=3D"listDepth"/>

        <xsl:variable name=3D"nodeNameTop" select=3D"name()"/>

        <xsl:message>

            Node Name Top Level: <xsl:value-of select=3D"$nodeNameTop"/>

        </xsl:message>

        <!-- This varibale allows to start from any element in the list,
eg. numbered lists can start from 7 not 1. -->

        <xsl:variable name=3D"format" select=3D"@style"/>

        <fo:list-block>

            <xsl:for-each select=3D"*">

                <xsl:variable name=3D"nodeName" select=3D"name()"/>

                <xsl:message>

                    Node Name for each: <xsl:value-of
select=3D"$nodeName"/>

                </xsl:message>

                <!-- If current item is a list item -->

                <xsl:if test=3D"$nodeName =3D 'li'">

                    <fo:list-item>

                        <!--Call the lineItem template to decide the
label format and indent-->

                        <xsl:call-template name=3D"lineItemList">

                            <xsl:with-param name=3D"numberFormat"
select=3D"$format"/>

                            <xsl:with-param name=3D"levelNumber"
select=3D"$levelNumber"/>

                            <xsl:with-param name=3D"levelStartIndent"
select=3D"number($indentSize) * number(number($levelNumber) - 1)"/>

                        </xsl:call-template>

=20

                        <xsl:variable name=3D"indentValueOL"
select=3D"number($indentSize)  * number($levelNumber) - 15"/>

                        <fo:list-item-body end-indent=3D"0pt"
start-indent=3D"{$indentValueOL}pt">

                            <fo:block text-align=3D"start"
text-indent=3D"0pt">

                                <!--<xsl:apply-templates Exclude child
OL elements>-->

                                <xsl:apply-templates select=3D"@* |
node()[not(self::ol)]">

                                    <xsl:with-param name=3D"levelNumber"
select=3D"number($levelNumber) +1"/>

                                    <xsl:with-param
name=3D"paragraphDepth" select=3D"number($paragraphDepth) + 1"/>

                                </xsl:apply-templates>

                            </fo:block>

                            <!--Here we need to check for nested OL
Lists-->

                            <xsl:if test=3D"ol">

                                <xsl:message>

                                Nested OL

                                </xsl:message>

                                <xsl:apply-templates>

                                    <!--Paragraphdepth is not being set
-->

                                    <xsl:with-param name=3D"listDepth"
select=3D"number($listDepth) + 1"/>

                                    <xsl:with-param name=3D"levelNumber"
select=3D"number($levelNumber) + 1"/>

                                    <xsl:with-param
name=3D"paragraphDepth" select=3D"number($paragraphDepth) + 1"/>

                                </xsl:apply-templates>

                                <!--DEBUG-->

                            </xsl:if>

=20

=20

                        </fo:list-item-body>

                    </fo:list-item>

                </xsl:if>

=20

                <!-- If current item is not a list item -->

                <xsl:if test=3D"not($nodeName =3D 'li')">

                    <fo:list-item>

                        <fo:list-item-label>

                            <fo:block></fo:block>

                        </fo:list-item-label>

                        <fo:list-item-body>

                            <xsl:apply-templates>

                                <!-- Need to pass an incremeted indent
as a parameter in case, this item is actually a nested list. -->

                                <xsl:with-param name=3D"levelNumber"
select=3D"number($levelNumber) +1"/>

                                <xsl:with-param name=3D"paragraphDepth"
select=3D"number($paragraphDepth) + 1"/>

                            </xsl:apply-templates>

                        </fo:list-item-body>

                    </fo:list-item>

                </xsl:if>

            </xsl:for-each>

        </fo:list-block>

    </xsl:template>

This is the Output NOTICE THE DUPLICATE Duty of Care that is not in the
XML :

Code:

Code:

Description: Test description 1

1. Duty of Care: The [Tenancy Lookup] has the responsibility for a duty
of care, for the land. This duty of

care includes taking al reasonable steps to do the following in relation
to the land:-

Duty of Care:

a. avoid causing or contributing to land salinity that -

i. reduces its productivity; or

ii. damages any other land;


This is the strong Tag:

Code:

<xsl:template match=3D"strong">

        <xsl:param name=3D"paragraphDepth"/>

        <fo:inline font-weight=3D"bold">

            <xsl:apply-templates>

                <xsl:with-param name=3D"paragraphDepth"
select=3D"number($paragraphDepth) + 1"/>

            </xsl:apply-templates>

        </fo:inline>

    </xsl:template>

Larry Edwardson
Software Developer
Information and Technology Partners

DAFF | DTESB | DEWS | DNRM | EHP | NPRSR |and Partners
Floor 8 | Landcentre | 867 Main Street | GPO Box 2454 | Brisbane Qld 4001
Tel (07)  | Mob
Email  Larry.Edwardson@xxxxxxxxxxxxxxx


------------------------------
The information in this email together with any attachments is intended only
for the person or entity to which it is addressed and may contain confidential
and/or privileged material. There is no waiver of any
confidentiality/privilege by your inadvertent receipt of this material.
Any form of review, disclosure, modification, distribution and/or publication
of this email message is prohibited, unless as a necessary part of
Departmental business.
If you have received this message in error, you are asked to inform the sender
as quickly as possible and delete this message and any copies of this message
from your computer and/or your computer system network.
------------------------------

Current Thread