You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by a3leggeddog <se...@3ldinc.com> on 2014/04/05 02:49:01 UTC
Nested Bulleted Lists Problem
Hello -
I am trying to convert a nested, bulleted list in HTML to XML-FO for output
as a PDF in Apache FOP. The HTML looks like this
<ul>
<li>Item Number1</li>
<ul>
<li>Sub-Item 1</li>
<li>Sub-Item 2</li>
</ul>
</ul>
All of the XSLT I have tried creates a with an embedded for the subitems.
FOP, however, complains that you can't have a list-block as a child of a
list-block. Is this an issue with FOP? Or, is that simply not valid XML-FO
and all of the XSLT examples are processing this construct incorrectly?
If it's the later, what is the proper XML-FO to produce a nested set of
bullets like you would see in HTML?
Any help would be greatly appreciated!
Thanks!
--
View this message in context: http://apache-fop.1065347.n5.nabble.com/Nested-Bulleted-Lists-Problem-tp40436.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Nested Bulleted Lists Problem
Posted by "Terence M. Bandoian" <te...@tmbsw.com>.
On 4/4/2014 8:21 PM, a3leggeddog wrote:
> Thanks for the quick response!
>
> Yes, if you have examples, that would be great. You wouldn't happen to have
> an XSLT example? The one I have produces XML-FO that looks like this:
>
> <fo:list-block space-before="1em" space-after="1em"
> role="html:ul">
> <fo:list-item relative-align="baseline"
> provisional-distance-between-starts="0.3cm"
> provisional-label-separation="0.3cm" role="html:li"><fo:list-item-label
> end-indent="label-end()" text-align="end"
> wrap-option="no-wrap"><fo:block><fo:inline font="1em
> serif">•</fo:inline></fo:block></fo:list-item-label><fo:list-item-body
> start-indent="body-start()" text-indent="0"><fo:block>Item
> Number1</fo:block></fo:list-item-body></fo:list-item>
> <fo:list-block space-before="1em" space-after="1em"
> role="html:ul">
> <fo:list-item relative-align="baseline"
> provisional-distance-between-starts="0.3cm"
> provisional-label-separation="0.3cm" role="html:li"><fo:list-item-label
> end-indent="label-end()" text-align="end"
> wrap-option="no-wrap"><fo:block><fo:inline font="0.67em monospace"
> baseline-shift="0.25em">o</fo:inline></fo:block></fo:list-item-label><fo:list-item-body
> start-indent="body-start()" text-indent="0"><fo:block>Sub-Item
> 1</fo:block></fo:list-item-body></fo:list-item>
> <fo:list-item relative-align="baseline"
> provisional-distance-between-starts="0.3cm"
> provisional-label-separation="0.3cm" role="html:li"><fo:list-item-label
> end-indent="label-end()" text-align="end"
> wrap-option="no-wrap"><fo:block><fo:inline font="0.67em monospace"
> baseline-shift="0.25em">o</fo:inline></fo:block></fo:list-item-label><fo:list-item-body
> start-indent="body-start()" text-indent="0"><fo:block>Sub-Item
> 2</fo:block></fo:list-item-body></fo:list-item>
> </fo:list-block>
> </fo:list-block>
>
> The XSL looks like this:
>
>
>
> <xsl:template match="html:ul">
> <fo:list-block xsl:use-attribute-sets="ul">
> <xsl:call-template name="process-common-attributes-and-children"/>
> </fo:list-block>
> </xsl:template>
>
> <xsl:template match="html:li//html:ul">
> <fo:list-block xsl:use-attribute-sets="ul-nested">
> <xsl:call-template name="process-common-attributes-and-children"/>
> </fo:list-block>
> </xsl:template>
>
> <xsl:template match="html:ol">
> <fo:list-block xsl:use-attribute-sets="ol">
> <xsl:call-template name="process-common-attributes-and-children"/>
> </fo:list-block>
> </xsl:template>
>
> <xsl:template match="html:li//html:ol">
> <fo:list-block xsl:use-attribute-sets="ol-nested">
> <xsl:call-template name="process-common-attributes-and-children"/>
> </fo:list-block>
> </xsl:template>
>
> <xsl:template match="html:ul/html:li">
> <fo:list-item xsl:use-attribute-sets="ul-li">
> <xsl:call-template name="process-ul-li"/>
> </fo:list-item>
> </xsl:template>
>
> <xsl:template name="process-ul-li">
> <xsl:call-template name="process-common-attributes"/>
> <fo:list-item-label end-indent="label-end()" text-align="end"
> wrap-option="no-wrap">
> <fo:block>
> <xsl:variable name="depth" select="count(ancestor::html:ul)"/>
> <xsl:choose>
> <xsl:when test="$depth = 1">
> <fo:inline xsl:use-attribute-sets="ul-label-1">
> <xsl:value-of select="$ul-label-1"/>
> </fo:inline>
> </xsl:when>
> <xsl:when test="$depth = 2">
> <fo:inline xsl:use-attribute-sets="ul-label-2">
> <xsl:value-of select="$ul-label-2"/>
> </fo:inline>
> </xsl:when>
> <xsl:otherwise>
> <fo:inline xsl:use-attribute-sets="ul-label-3">
> <xsl:value-of select="$ul-label-3"/>
> </fo:inline>
> </xsl:otherwise>
> </xsl:choose>
> </fo:block>
> </fo:list-item-label>
> <fo:list-item-body start-indent="body-start()" text-indent="0">
> <fo:block>
> <xsl:apply-templates/>
> </fo:block>
> </fo:list-item-body>
> </xsl:template>
>
> It was seemingly designed for nested lists, so I'm not sure if it's just an
> issue with FOP.
>
> Best,
> Seth
Hi, Seth-
It looks like nesting is the problem. In the output above, the inner
<fo:list-block> is a direct descendant of the outer <fo:list-block>.
I'd try moving it to within the <fo:list-item-body> of the immediately
preceding <fo:list-item>.
-Terence Bandoian
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Nested Bulleted Lists Problem
Posted by a3leggeddog <se...@3ldinc.com>.
Thanks for the quick response!
Yes, if you have examples, that would be great. You wouldn't happen to have
an XSLT example? The one I have produces XML-FO that looks like this:
<fo:list-block space-before="1em" space-after="1em"
role="html:ul">
<fo:list-item relative-align="baseline"
provisional-distance-between-starts="0.3cm"
provisional-label-separation="0.3cm" role="html:li"><fo:list-item-label
end-indent="label-end()" text-align="end"
wrap-option="no-wrap"><fo:block><fo:inline font="1em
serif">•</fo:inline></fo:block></fo:list-item-label><fo:list-item-body
start-indent="body-start()" text-indent="0"><fo:block>Item
Number1</fo:block></fo:list-item-body></fo:list-item>
<fo:list-block space-before="1em" space-after="1em"
role="html:ul">
<fo:list-item relative-align="baseline"
provisional-distance-between-starts="0.3cm"
provisional-label-separation="0.3cm" role="html:li"><fo:list-item-label
end-indent="label-end()" text-align="end"
wrap-option="no-wrap"><fo:block><fo:inline font="0.67em monospace"
baseline-shift="0.25em">o</fo:inline></fo:block></fo:list-item-label><fo:list-item-body
start-indent="body-start()" text-indent="0"><fo:block>Sub-Item
1</fo:block></fo:list-item-body></fo:list-item>
<fo:list-item relative-align="baseline"
provisional-distance-between-starts="0.3cm"
provisional-label-separation="0.3cm" role="html:li"><fo:list-item-label
end-indent="label-end()" text-align="end"
wrap-option="no-wrap"><fo:block><fo:inline font="0.67em monospace"
baseline-shift="0.25em">o</fo:inline></fo:block></fo:list-item-label><fo:list-item-body
start-indent="body-start()" text-indent="0"><fo:block>Sub-Item
2</fo:block></fo:list-item-body></fo:list-item>
</fo:list-block>
</fo:list-block>
The XSL looks like this:
<xsl:template match="html:ul">
<fo:list-block xsl:use-attribute-sets="ul">
<xsl:call-template name="process-common-attributes-and-children"/>
</fo:list-block>
</xsl:template>
<xsl:template match="html:li//html:ul">
<fo:list-block xsl:use-attribute-sets="ul-nested">
<xsl:call-template name="process-common-attributes-and-children"/>
</fo:list-block>
</xsl:template>
<xsl:template match="html:ol">
<fo:list-block xsl:use-attribute-sets="ol">
<xsl:call-template name="process-common-attributes-and-children"/>
</fo:list-block>
</xsl:template>
<xsl:template match="html:li//html:ol">
<fo:list-block xsl:use-attribute-sets="ol-nested">
<xsl:call-template name="process-common-attributes-and-children"/>
</fo:list-block>
</xsl:template>
<xsl:template match="html:ul/html:li">
<fo:list-item xsl:use-attribute-sets="ul-li">
<xsl:call-template name="process-ul-li"/>
</fo:list-item>
</xsl:template>
<xsl:template name="process-ul-li">
<xsl:call-template name="process-common-attributes"/>
<fo:list-item-label end-indent="label-end()" text-align="end"
wrap-option="no-wrap">
<fo:block>
<xsl:variable name="depth" select="count(ancestor::html:ul)"/>
<xsl:choose>
<xsl:when test="$depth = 1">
<fo:inline xsl:use-attribute-sets="ul-label-1">
<xsl:value-of select="$ul-label-1"/>
</fo:inline>
</xsl:when>
<xsl:when test="$depth = 2">
<fo:inline xsl:use-attribute-sets="ul-label-2">
<xsl:value-of select="$ul-label-2"/>
</fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:inline xsl:use-attribute-sets="ul-label-3">
<xsl:value-of select="$ul-label-3"/>
</fo:inline>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()" text-indent="0">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:list-item-body>
</xsl:template>
It was seemingly designed for nested lists, so I'm not sure if it's just an
issue with FOP.
Best,
Seth
--
View this message in context: http://apache-fop.1065347.n5.nabble.com/Nested-Bulleted-Lists-Problem-tp40436p40440.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Nested Bulleted Lists Problem
Posted by Rob Sargent <rs...@xmission.com>.
Think of it as one list, with various indents and bullet-types according
to the nestedness of your input.
I have examples (at home) if you need them - to four bullet levels
On 04/04/2014 06:49 PM, a3leggeddog wrote:
> Hello -
>
> I am trying to convert a nested, bulleted list in HTML to XML-FO for output
> as a PDF in Apache FOP. The HTML looks like this
>
> <ul>
> <li>Item Number1</li>
> <ul>
> <li>Sub-Item 1</li>
> <li>Sub-Item 2</li>
> </ul>
> </ul>
>
> All of the XSLT I have tried creates a with an embedded for the subitems.
> FOP, however, complains that you can't have a list-block as a child of a
> list-block. Is this an issue with FOP? Or, is that simply not valid XML-FO
> and all of the XSLT examples are processing this construct incorrectly?
>
> If it's the later, what is the proper XML-FO to produce a nested set of
> bullets like you would see in HTML?
>
> Any help would be greatly appreciated!
>
> Thanks!
>
>
>
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/Nested-Bulleted-Lists-Problem-tp40436.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
Re: Nested Bulleted Lists Problem
Posted by a3leggeddog <se...@3ldinc.com>.
Thanks, Tom!
Sent from my iPhone
> On Apr 6, 2014, at 2:02 PM, "Tom Morrison [via Apache FOP]" <ml...@n5.nabble.com> wrote:
>
> Feel free to post XSLT questions here:
>
> http://www.tek-tips.com/threadminder.cfm?pid=426
>
>
>
> I will do my best to answer them in that forum, as I have been doing for years.
>
>
>
> Best regards,
>
> Tom Morrison
>
>
>
> From: Glenn Adams [mailto:[hidden email]]
> [snip]
>
>
>
> in the future, it would be better to pursue XSLT questions on MLs that focus on XSLT functionality
>
>
>
> If you reply to this email, your message will be added to the discussion below:
> http://apache-fop.1065347.n5.nabble.com/Nested-Bulleted-Lists-Problem-tp40436p40450.html
> To unsubscribe from Nested Bulleted Lists Problem, click here.
> NAML
--
View this message in context: http://apache-fop.1065347.n5.nabble.com/Nested-Bulleted-Lists-Problem-tp40436p40451.html
Sent from the FOP - Users mailing list archive at Nabble.com.
RE: Nested Bulleted Lists Problem
Posted by Tom Morrison <to...@hillcountrysoftware.com>.
Feel free to post XSLT questions here:
http://www.tek-tips.com/threadminder.cfm?pid=426
I will do my best to answer them in that forum, as I have been doing for years.
Best regards,
Tom Morrison
From: Glenn Adams [mailto:glenn@skynav.com]
[snip]
in the future, it would be better to pursue XSLT questions on MLs that focus on XSLT functionality
Re: Nested Bulleted Lists Problem
Posted by Glenn Adams <gl...@skynav.com>.
the folks on this ML may be awesome, but keep in mind that the content of
your thread has little to do with FOP and mostly to do with XSLT; although
FOP provides a convenience function for ingesting XML along with an XSLT
stylesheet, that isn't the primary function of FOP, which is formatting
XSL-FO content;
in the future, it would be better to pursue XSLT questions on MLs that
focus on XSLT functionality
On Sat, Apr 5, 2014 at 1:09 PM, a3leggeddog <se...@3ldinc.com> wrote:
> First of all, let me just say that this mailing list is awesome! I can't
> thank you all enough for all of your help - I really appreciate it.
>
> Yes, sadly I'm going from HTML and, worse, I'm going from HTML that I can't
> control. In fact, this particular issue is the result of HTML produced by
> an HTML control: ckEditor.
>
> I have a lot to go on here, and I'm continuing to mess with the XSLT. If I
> can get it to work, I'll reposted here so, hopefully, someone else can
> benefit. I will also reach out to ckSource because I don't believe what
> they're producing is valid HTML either.
>
> Best,
> Seth
>
>
>
> --
> View this message in context:
> http://apache-fop.1065347.n5.nabble.com/Nested-Bulleted-Lists-Problem-tp40436p40448.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
Re: Nested Bulleted Lists Problem
Posted by a3leggeddog <se...@3ldinc.com>.
First of all, let me just say that this mailing list is awesome! I can't
thank you all enough for all of your help - I really appreciate it.
Yes, sadly I'm going from HTML and, worse, I'm going from HTML that I can't
control. In fact, this particular issue is the result of HTML produced by
an HTML control: ckEditor.
I have a lot to go on here, and I'm continuing to mess with the XSLT. If I
can get it to work, I'll reposted here so, hopefully, someone else can
benefit. I will also reach out to ckSource because I don't believe what
they're producing is valid HTML either.
Best,
Seth
--
View this message in context: http://apache-fop.1065347.n5.nabble.com/Nested-Bulleted-Lists-Problem-tp40436p40448.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Nested Bulleted Lists Problem
Posted by Rob Sargent <rs...@xmission.com>.
Just occurs to me your starting point is HTML so your mileage will definitely vary. Sorry.
Sent from my iPhone
> On Apr 5, 2014, at 9:05 AM, Rob Sargent <rs...@xmission.com> wrote:
>
> 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-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Nested Bulleted Lists Problem
Posted by Rob Sargent <rs...@xmission.com>.
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-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
RE: Nested Bulleted Lists Problem
Posted by Manuel Mall <mm...@arcus.com.au>.
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-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Nested Bulleted Lists Problem
Posted by "Terence M. Bandoian" <te...@tmbsw.com>.
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
Hi, Seth-
Sorry, I don't. Sounds like Rob might though.
-Terence Bandoian
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Nested Bulleted Lists Problem
Posted by a3leggeddog <se...@3ldinc.com>.
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
--
View this message in context: http://apache-fop.1065347.n5.nabble.com/Nested-Bulleted-Lists-Problem-tp40436p40441.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Nested Bulleted Lists Problem
Posted by "Terence M. Bandoian" <te...@tmbsw.com>.
On 4/4/2014 8:06 PM, Terence M. Bandoian wrote:
> On 4/4/2014 7:49 PM, a3leggeddog wrote:
>> Hello -
>>
>> I am trying to convert a nested, bulleted list in HTML to XML-FO for
>> output
>> as a PDF in Apache FOP. The HTML looks like this
>>
>> <ul>
>> <li>Item Number1</li>
>> <ul>
>> <li>Sub-Item 1</li>
>> <li>Sub-Item 2</li>
>> </ul>
>> </ul>
>>
>> All of the XSLT I have tried creates a with an embedded for the
>> subitems.
>> FOP, however, complains that you can't have a list-block as a child of a
>> list-block. Is this an issue with FOP? Or, is that simply not valid
>> XML-FO
>> and all of the XSLT examples are processing this construct incorrectly?
>>
>> If it's the later, what is the proper XML-FO to produce a nested set of
>> bullets like you would see in HTML?
>>
>> Any help would be greatly appreciated!
>>
>> Thanks!
>
> Hi-
>
> I'm not sure this would resolve the issue you're facing but I've
> successfully nested <fo:list-block> elements by placing the child
> <fo:list-block> inside the <fo:list-item-body> element of the parent
> <fo:list-block>.
>
> Hope that helps.
>
> -Terence Bandoian
Actually, that should say inside the <fo:list-item-body> of an
<fo:list-item> in the parent <fo:list-block>.
-Terence Bandoian
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Nested Bulleted Lists Problem
Posted by "Terence M. Bandoian" <te...@tmbsw.com>.
On 4/4/2014 7:49 PM, a3leggeddog wrote:
> Hello -
>
> I am trying to convert a nested, bulleted list in HTML to XML-FO for output
> as a PDF in Apache FOP. The HTML looks like this
>
> <ul>
> <li>Item Number1</li>
> <ul>
> <li>Sub-Item 1</li>
> <li>Sub-Item 2</li>
> </ul>
> </ul>
>
> All of the XSLT I have tried creates a with an embedded for the subitems.
> FOP, however, complains that you can't have a list-block as a child of a
> list-block. Is this an issue with FOP? Or, is that simply not valid XML-FO
> and all of the XSLT examples are processing this construct incorrectly?
>
> If it's the later, what is the proper XML-FO to produce a nested set of
> bullets like you would see in HTML?
>
> Any help would be greatly appreciated!
>
> Thanks!
Hi-
I'm not sure this would resolve the issue you're facing but I've
successfully nested <fo:list-block> elements by placing the child
<fo:list-block> inside the <fo:list-item-body> element of the parent
<fo:list-block>.
Hope that helps.
-Terence Bandoian
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org