Can you nest user macros in Confluence?

I just tried to nest two user macros and got this error message:

Error rendering macro 'ref-standards' : Failed to transform the HTML macro template for display. 
Nested message: The XML content could not be parsed. There is a problem at line 1, column 978. 
Parser message: Duplicate attribute 'id'. at [row,col {unknown-source}]: [1,978]

The outer macro was

## Macro title: Reference to standards
## Macro has a body: Y
## Body processing: Rendered
## Developed by: David Stephensen
## Date created: 17-Jun-2013
## Installed by: David Stephensen
## Encloses standards reference block in a DIV with an ID 
## @noparams
<div id="ref-standards">$body</div>

and the inner one (actually there were 3 similar ones one after the other, but just putting one in did not work either) was

## Macro title: Reference to ISO 9001
## Macro has a body: Y
## Body processing: Rendered
## Developed by: David Stephensen
## Date created: 17-Jun-2013
## Installed by: David Stephensen
## Encloses ISO 9001 reference in a DIV with an ID 
## @noparams
<div id="ref-iso-9001">$body</div>

All of the macros work fine individually. Am I meant to be able to do this? Is there a trick?

2 answers

1 accepted

Hi there David, I believe that you are running into this issue: https://jira.atlassian.com/browse/CONF-23412

Long story short, you can nest macros inside each other, but you may run into issues if you use headings within them.

At Atlassian we allow our customers to input into our bug fix and feature request prioritisation. We do this with the voting system - the more votes and detailed comments a ticket has, the more likely it is to be implemented. We use this as a way of gauging the needs of our customer base as a whole. I'd recommend voting on that ticket, and adding a comment detailing how it affects your system and what you would like to see. If you also add yourself as a watcher to the ticket, you'll be notified whenever it's updated.

Thanks, Denise! You are a champion as always! Now I know what is happening I have been able to do a workaround that fixes the problem for me.

I just converted the headings in the inner (nested) text into bold paragraphs. Instantly out of trouble now I know what was going on!

I hope someone adopts this bug and fixes it soon. It is a bit of a worry for the deer-in-the-headlights club, of which I am a fully paid up member.

The error was

Failed to transform the HTML macro template for display. Nested message:
The XML content could not be parsed. There is a problem at line 1, column 978.
Parser message: Duplicate attribute 'id'. at [row,col {unknown-source}]: [1,978]

The outer one was

## Macro title: Reference to standards
## Macro has a body: Y
## Body processing: Rendered
## Developed by: David Stephensen
## Date created: 17-Jun-2013
## Installed by: David Stephensen
## Encloses standards reference block in a DIV with an ID 
## @noparams
<div id="ref-standards">$body</div>

the inner one was

## Macro title: Reference to ISO 9001
## Macro has a body: Y
## Body processing: Rendered
## Developed by: David Stephensen
## Date created: 17-Jun-2013
## Installed by: David Stephensen
## Encloses ISO 9001 reference in a DIV with an ID 
## @noparams
<div id="ref-iso-9001">$body</div>

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 Apr 13, 2018 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...

372 views 20 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