Parsing this with Xalan 2.7.1
This is the XML
Code:
<Condition>
<ol>
<li><strong>Duty of Care:</strong> The [Tenancy Lookup] has the responsibility for the land. This duty of care includes taking al reasonable steps to do the following in relation to the land:-
<ol style="list-style-type: lower-alpha">
<li>avoid causing or contributing to land salinity that -
<ol style="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 my xsltfo snippit
Code:
<xsl:template match="ol">
<!-- Template parameter that specifies level of indentation. Set to 1 by default - if not specified. -->
<xsl:param name="levelNumber">1</xsl:param>
<xsl:param name="paragraphDepth"/>
<xsl:param name="listDepth"/>
<xsl:variable name="nodeNameTop" select="name()"/>
<xsl:message>
Node Name Top Level: <xsl:value-of select="$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="format" select="@style"/>
<fo:list-block>
<xsl:for-each select="*">
<xsl:variable name="nodeName" select="name()"/>
<xsl:message>
Node Name for each: <xsl:value-of select="$nodeName"/>
</xsl:message>
<!-- If current item is a list item -->
<xsl:if test="$nodeName = 'li'">
<fo:list-item>
<!--Call the lineItem template to decide the label format and indent-->
<xsl:call-template name="lineItemList">
<xsl:with-param name="numberFormat" select="$format"/>
<xsl:with-param name="levelNumber" select="$levelNumber"/>
<xsl:with-param name="levelStartIndent" select="number($indentSize) * number(number($levelNumber) - 1)"/>
</xsl:call-template>
<xsl:variable name="indentValueOL" select="number($indentSize) * number($levelNumber) - 15"/>
<fo:list-item-body end-indent="0pt" start-indent="{$indentValueOL}pt">
<fo:block text-align="start" text-indent="0pt">
<!--<xsl:apply-templates Exclude child OL elements>-->
<xsl:apply-templates select="@* | node()[not(self::ol)]">
<xsl:with-param name="levelNumber" select="number($levelNumber) +1"/>
<xsl:with-param name="paragraphDepth" select="number($paragraphDepth) + 1"/>
</xsl:apply-templates>
</fo:block>
<!--Here we need to check for nested OL Lists-->
<xsl:if test="ol">
<xsl:message>
Nested OL
</xsl:message>
<xsl:apply-templates>
<!--Paragraphdepth is not being set -->
<xsl:with-param name="listDepth" select="number($listDepth) + 1"/>
<xsl:with-param name="levelNumber" select="number($levelNumber) + 1"/>
<xsl:with-param name="paragraphDepth" select="number($paragraphDepth) + 1"/>
</xsl:apply-templates>
<!--DEBUG-->
</xsl:if>
</fo:list-item-body>
</fo:list-item>
</xsl:if>
<!-- If current item is not a list item -->
<xsl:if test="not($nodeName = '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="levelNumber" select="number($levelNumber) +1"/>
<xsl:with-param name="paragraphDepth" select="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, can post complete file if needed
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;
Notice Duty of care prints twice, I have no idea why this would occur.
This is the strong tag for completeness
Code:
<xsl:template match="strong">
<xsl:param name="paragraphDepth"/>
<fo:inline font-weight="bold">
<xsl:apply-templates>
<xsl:with-param name="paragraphDepth" select="number($paragraphDepth) + 1"/>
</xsl:apply-templates>
</fo:inline>
</xsl:template>
Anyone, I have been on this too long, banging my head a the moment