TOC macro throws up exception on some pages but not others

Steve Goldberg
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 7, 2012

I use the TOC macro all over my pages but on some pages (seemingly inexplicably) it throws up an exception on some pages but not others. I get the following error:

Error rendering macro 'toc' : [com.ctc.wstx.exc.WstxLazyException] com.ctc.wstx.exc.WstxParsingException: Duplicate attribute 'id'. at [row,col {unknown-source}]: [7,688]

I can't figure out why. Anybody know?

4 answers

2 votes
hsuhailah
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2012

Looks like you are hitting a known bug as raised here: https://jira.atlassian.com/browse/CONF-23412

Unfortunately, there's no workaround at the moment. You may want to vote for it to be fixed and watch the page for any future updates.

Steve Goldberg
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2012

You're right, I found this out a few days after I posted the question here. I can report that the way to work around this is not to avoid putting headers within other macros. It doesn't happen all the time but the instance where it was breaking for me, I could get around it by doing this.

Like scoffin likes this
1 vote
Mick Davidson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 5, 2013

Steve,

I've got the same problem.

Can you explain what you mean by "the way to work around this is not to avoid putting headers within other macros" please?

IE, what does "not to avoid " and "headers" mean? Should headers be headings?

This is what our code looks like in HTML:

<p>
<ac:macro ac:name="toc">
<ac:parameter ac:name="maxLevel">3</ac:parameter>
</ac:macro>
</p>

I've tried moving the macro around within the page structure, deleting it altogether and adding a new one, and nothing works.

Cheers.

Steve Goldberg
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2013

Grammar fail. Take what I said and remove the word "not" and change the word "headers": I can report that the way to work around this is to avoid putting headings within other macros

In other words, it's nothing to do with your macro that is generating the TOC but rather where you are putting your h1s, h2s, etc. Ensure your headings are only in the page body.

Like scoffin likes this
scoffin October 16, 2019

I can't believe I'm reading and liking this workaround from over 6 years ago because the same issue still persists! Either bring back my beloved Anchor macros or fix the table of contents!

Like # people like this
0 votes
Mick Davidson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2013

Steve, good point, I've just added it. Cheers.

0 votes
Mick Davidson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2013

Steve,

OK, I tried what you said but it didn't work. However, given what you said, I went through a copy of the entire page and started changing/removing elements (headings, macros etc), one at a time.

So all the headings were changed to paragraph, various macros were removed and re-instated. Finally I removed a macro called HTML Comment, and bingo Johnny! the TOC started rendering. :)

I then tested that all was ok by changing everything back to normal and it still works.

This means that the solution in your case isn't the solution in mine. Were/are you using the HTML Comment macro on any of your problem pages?

I think I have another page that is having the same problem, when I find that I'll run the same experiment again and report my findings here.

Cheers.

Steve Goldberg
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2013

I wasn't actually using that macro so it's interesting that you had the same problem but with a different cause. Have you updated the JIRA ticket with this additional information? It could be useful for Atlassian.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events