Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access a node's parent attribute #8

Open
marnunez opened this issue Mar 26, 2018 · 2 comments
Open

Access a node's parent attribute #8

marnunez opened this issue Mar 26, 2018 · 2 comments

Comments

@marnunez
Copy link

Hi! Is this funcionality implemented?

xml.integer('..', attribute='nFrames', alias='_nFrames')]

I need for each child to have a copy of its parent "nFrames" attribute. Is this achievable with XPath?

@gatkin
Copy link
Owner

gatkin commented Mar 28, 2018

I think that should be possible, but it would be good to add some tests to verify it is possible. One thing we would need to consider is what to do when serializing the value since we will have multiple items referring to the same attribute. Do we let the first value we encounter win and make that the value of the attribute when serializing? What do we do if the items that should serialize to the same attribute have different values?

@marnunez
Copy link
Author

I think it should be the last item serialized that defines its parent's attribute, just like with normal variables. I'm not sure how this is implemented in other parsers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants