Ordered list letters instead of numbers for specific instances

Here should go questions about transforming XML with XSLT and FOP.
josecotes
Posts: 19

Ordered list letters instead of numbers for specific instances

Thu Apr 20, 2017 10:13 pm

Hi all,

This is my xml:

Code: Select all

<topic><title/><body>
<ol>
   <li>Item 1</li>
   <li>Item 2</li>
</ol>
</body></topic>


When I produce a PDF it comes as this:
Image

Now, I need letters instead of numbers for just this particular instance, so I added an outputclass="lower-alpha" to my <ol> tag:

Code: Select all

<topic><title/><body>
<ol outputclass="lower-alpha">
   <li>Item 1</li>
   <li>Item 2</li>
</ol>
</body></topic>


And then, in my plugin, I added this (see box):
Image

For some reason, this is not working and I am still getting numbers. Any clues?

Thanks all,
Radu
Posts: 5088

Re: Ordered list letters instead of numbers for specific instances

Fri Apr 21, 2017 8:12 am

Hi,

The XSLT template seems to match the list item element but the @outputclass is set on the OL element. So maybe you should retrieve its value like parent::node()/@outputclass.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
josecotes
Posts: 19

Re: Ordered list letters instead of numbers for specific instances

Fri Apr 21, 2017 3:35 pm

Thanks a lot!

This is exactly how I implemented it and it worked:

Code: Select all

<xsl:when test="parent::node()/@outputclass='lower-alpha'">
   <xsl:number format="a"/>
</xsl:when>

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 0 guests