I am converting two XSLT files to freemarker. One is HTML and the other is FO. I need to be able to generate list item labels based on a variable typeordered which can be one of the values 1, a, A, i, I (as used in html ordered list type).
Original html.xsl
<ol type="{typeordered}">
<li>...</li>
</ol>
Original fo.xsl
<fo:list-item>
<fo:list-item-label end-indent="label-end()">
<fo:block><xsl:number format="{typeordered}" /></fo:block>
</fo:list-item-label>
...
</fo:list-item>
FO freemarker version. can do lower / upper case alphabet but how to do roman numerals? seems overly complicated?
<#macro listItemM listItem listElement n>
<fo:list-item>
<fo:list-item-label end-indent="label-end()">
<fo:block>
<#if listElement.type == "ordered">
<#if listElement.typeordered??>
<#if listElement.typeordered == "a">
${n?lower_abc}
<#elseif listElement.typeordered == "A">
${n?upper_abc}
<#else>
${n}
</#if>
<#else>
${n}
</#if>.
<#else>
•
</#if>
</fo:block>
</fo:list-item-label>
...
</fo:list-item>