Re: [NTG-context] accessing xml element attributes in lua, how, if you do not want to use the .at scheme?

2020-06-09 Thread mf

Il 09/06/20 15:31, Gerben Wierda ha scritto:
I’ve been trying to find out how I can access XML node 
properties/attributes in lua other than via the .at syntactic scheme but 
using the property/attribute name as a string.


E.g., currently I do:

someVar = someNode.at.someProperty

but I would like to do something /like/

someVar = someNode[“someProperty”] or someNode.attribute(“someProperty”) 
or something where I can use the string version of the 
properties/attribute name.


It’s probably possible (after all these are all dynamic structures that 
come from data), but how exactly?




local prop = "someProperty"
someVar = someNode.at[ prop ]

Massi
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] accessing xml element attributes in lua, how, if you do not want to use the .at scheme?

2020-06-09 Thread Gerben Wierda
I’ve been trying to find out how I can access XML node properties/attributes in 
lua other than via the .at syntactic scheme but using the property/attribute 
name as a string.

E.g., currently I do:

someVar = someNode.at.someProperty

but I would like to do something like

someVar = someNode[“someProperty”] or someNode.attribute(“someProperty”) or 
something where I can use the string version of the properties/attribute name.

It’s probably possible (after all these are all dynamic structures that come 
from data), but how exactly?

Thanks,

G

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___