TOC macro throws up exception on some pages but not others

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

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.

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.

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.

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.

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.

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.

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

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Friday in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

264 views 11 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you