Can you nest user macros in Confluence?
Asked by David Stephensen:

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&lt;div id="ref-standards"&gt;$body&lt;/div&gt;
```

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&lt;div id="ref-iso-9001"&gt;$body&lt;/div&gt;
```

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


Answers:
author: Denise Unterwurzacher [Atlassian]
body: 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.

comments: author: David Stephensen
body: 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.


author: David Stephensen
body: 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&lt;div id="ref-standards"&gt;$body&lt;/div&gt;
```

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&lt;div id="ref-iso-9001"&gt;$body&lt;/div&gt;
```


Tags: embed

user-macro