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

[Top] [All Lists]

Re: [xsl] Duplicate output for nested list Help

2013-07-15 09:10:50
I have a few comments to make regarding style, in addition to what I think is the answer to your question.

At 2013-07-15 16:06 +1000, Edwardson Larry wrote:
This is the XML:

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

I note in your data that <strong> and <ol> are siblings.

So in your XSLT when you test that you have an <ol> child, you process *all* children of <li> which reprocesses your <strong> a second time:

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

You probably only want <xsl:apply-templates select="ol"> in order not to process other siblings.

But I suspect the structure of your stylesheet could be changed to do more matching so as to reduce the amount of special casing that you are doing. But it is difficult to advise without seeing more of your specification.

Regarding style, this technique of checking "what am I" is particularly frowned upon in stylesheet:

                <xsl:variable name="nodeName" select="name()"/>
                <xsl:if test="$nodeName = 'li'">

... where you should be using test="self::li" ... which, actually, you are using elsewhere in your stylesheet:

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

And your depth counting may be able to be addressed with counting nodes in the source node tree declaratively rather than imperatively maintaining depth counters in raw stylesheet code.

I hope this is helpful.

. . . . . . . . . Ken

Public XSLT, XSL-FO, and UBL classes in the Netherlands     Oct 2013 |
Public XSLT, XSL-FO, UBL and code list classes in Australia Oct 2013 |
Contact us for world-wide XML consulting and instructor-led training |
Free 5-hour lecture: |
Crane Softwrights Ltd.   |
G. Ken Holman                   mailto:gkholman(_at_)CraneSoftwrights(_dot_)com 
Google+ profile: |
Legal business disclaimers: |

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

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