this is a german Web-Mirror of MHONARC.ORG powered by Domainunion AG

xsl-list
[Top] [All Lists]

[xsl] Duplicate output for nested list Help

2013-07-15 01:07:51
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(_dot_)Edwardson(_at_)daff(_dot_)qld(_dot_)gov(_dot_)au 


------------------------------
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.
------------------------------


--~------------------------------------------------------------------
XSL-List info and archive:  https://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: https://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>