If you don't switch over to the style sheet Manuel points us to, then might try something like below which gets include in the actual style sheet ( <xsl:include href="common/bullets.xsl"/>).

Couple of notes:
the "ElementConversion" is noise
your test will be <xsl:when test="name(../../..) = 'li'">
choose you own actual bullet character, hopefully you're using a modern, complete font


As I said earlier, they're rendered in a single list, as seen in the calls at the bottom. Luckily I know there are only four levels. If you don't have that knowledge you might have to recurse. In xsl. Oh what fun.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:ec="xalan://com.employer.utilities.ElementConversion"
xmlns:fo="http://www.w3.org/1999/XSL/Format";
xmlns:xalan="http://xml.apache.org/xslt";>

<xsl:param name="bulletOffset1">2.3pt</xsl:param>
<xsl:param name="bulletOffset2">10pt</xsl:param>
<xsl:param name="bulletOffset3">17pt</xsl:param>
<xsl:param name="bulletOffset4">25pt</xsl:param>
<xsl:param name="bulletChar1">•</xsl:param>
<xsl:param name="bulletChar2">◦</xsl:param>
<xsl:param name="bulletChar3">▪</xsl:param>
<xsl:param name="bulletChar4">–</xsl:param>

<xsl:template match="bullet">
<!-- we are forced to deduce the indentation level because the editor can shift bullet text blocks up and down which would (mostly) break if each bullet knew it's indent level -->
<xsl:choose>
<xsl:when test="name(../../..) = 'bullet'">
<xsl:call-template name="render-bullet">
<xsl:with-param name="bullet-offset" select="$bulletOffset4"/>
<xsl:with-param name="bullet-char" select="$bulletChar4"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="name(../..) = 'bullet'">
<xsl:call-template name="render-bullet">
<xsl:with-param name="bullet-offset" select="$bulletOffset3"/>
<xsl:with-param name="bullet-char" select="$bulletChar3"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="name(..) = 'bullet'">
<xsl:call-template name="render-bullet">
<xsl:with-param name="bullet-offset" select="$bulletOffset2"/>
<xsl:with-param name="bullet-char" select="$bulletChar2"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="render-bullet">
<xsl:with-param name="bullet-offset" select="$bulletOffset1"/>
<xsl:with-param name="bullet-char" select="$bulletChar1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<!-- decend through the bullets -->
<xsl:apply-templates select="*"/>
</xsl:template>

<xsl:template name="render-bullet">
<xsl:param name="bullet-offset"/>
<xsl:param name="bullet-char"/>
<fo:list-item margin-left="{$bullet-offset}">
<fo:list-item-label end-indent="label-end()">
<fo:block font-family="ITCStoneSerifCom-Medium" font-weight="normal" font-style="normal">
<xsl:value-of select="$bullet-char"/>
</fo:block>
</fo:list-item-label>
<xsl:call-template name="bullet-text"/>
</fo:list-item>
</xsl:template>

<xsl:template name="bullet-text">
<fo:list-item-body start-indent="body-start()">
<fo:block line-stacking-strategy="font-height" > <!-- keep-together.within-column="always" -->
<xsl:call-template name="excluded-text-highlight"/>
<!-- is there really an option here -->
<xsl:value-of select="text()"/>
</fo:block>
</fo:list-item-body>
</xsl:template>

</xsl:stylesheet>


And here is the call. This particular caller only goes down 3.


<xsl:template match="ddx">
<xsl:if test="count(*) != 0">
<fo:list-block font-family="ITCStoneSerifCom-Medium" font-size="9pt" provisional-distance-between-starts="8.0pt" provisional-label-separation="0.1pt">
<xsl:for-each select="*">
<xsl:call-template name="render-bullet">
<xsl:with-param name="bullet-offset" select="$bulletOffset1"/>
<xsl:with-param name="bullet-char" select="$bulletChar1"/>
</xsl:call-template>
<xsl:for-each select="bullet">
<xsl:call-template name="render-bullet">
<xsl:with-param name="bullet-offset" select="$bulletOffset2"/>
<xsl:with-param name="bullet-char" select="$bulletChar2"/>
</xsl:call-template>
<xsl:for-each select="bullet">
<xsl:call-template name="render-bullet">
<xsl:with-param name="bullet-offset" select="$bulletOffset3"/>
<xsl:with-param name="bullet-char" select="$bulletChar3"/>
</xsl:call-template>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</fo:list-block>
</xsl:if>
</xsl:template>


On 04/04/2014 09:36 PM, Manuel Mall wrote:
On 4/4/2014 8:25 PM, a3leggeddog wrote:
Hi Terence -

Thank you for your quick response!  I thought I tried that as well,
but I will give it another shot.  Do you have an XSL template that
will produce the correct XML-FO from HTML for nested lists?

Thanks,
Seth
Do a Google search for 'HTML 2 FO' or similar and you'll find a number
of solutions. For example Antenna House publishes a free HTML to FO
conversion stylesheet, i.e. on
http://www.antennahouse.com/XSLsample/XSLsample.htm you see a link to
http://www.antennahouse.com/XSLsample/sample-xsl-xhtml2fo/xhtml2fo.xsl
half way down the page in the section titled "Stylesheet for XHTML to
XSL-FO transformation".

Manuel

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org

Reply via email to