leforestier/yattag

stag attributes

war21x3b opened this issue · 2 comments

Hello.
I try to add attributes to stag.
If I do something like that

doc.stag('link:roleRef', roleURI='http://site.com/page')

it's working fine.
But when I try use more complex attributes, like link:roleURI='http://site.com/page' - it not work.

For 'tag' I can do next:

with tag('link:linkbase'):
 doc.attr(
  ("xmlns:link", "http://www.xbrl.org/2003/linkbase")
 )

and that works fine, but for 'stag' - is not!

How I can use attributes like link:roleURI='http://site.com/page' for 'stag'?

Hello,

you can supply attributes as (name, value) pairs with stag as well. For example:

doc.stag('link:linkbase', ('xmlns:link', 'http://www.xbrl.org/2003/linkbase'))

Then you get:

<link:linkbase xmlns:link="http://www.xbrl.org/2003/linkbase" />

Thanks, that is works for me.

I think will be fine to add that example to manual.
In manual I seen text about pairs of (name, value), but without example.

Thank you!