Open canercandan opened 9 years ago
This is really neat, your other pieces of code too.
Why not add these to the GSL repository, perhaps in a new directory?
On Fri, Dec 12, 2014 at 2:46 PM, Caner Candan notifications@github.com wrote:
Something that I am using quite a lot with my models is the ability to include XML files into others. I was usually doing it in hand-writing every time a GSL script to include a specific file (similarly to the example provided by the GSL guide) but honestly that sucks ;-) and I guess it's not in the MOP spirit. That's why I created a recursive function that includes every single node named include with an attribute file.
Here's a example of model in XML including other XML files:
script.gsl:
.template 0 process_inclusion() .endtemplate
project.xml:
file1.xml:
file2.xml:
file3/file3.xml:
Here is the actual source code of the function:
.template 0
function global.process_inclusion(context) my.context ?= project
my.found = 1 while my.found my.found = 0 for my.context.include as i
include file [i.file].xml
xml to my.context from "$(i.file:).xml" delete i my.found = 1 endfor
endwhile
for my.context. as ii where ii.name()?"include" <> "include" process_inclusion(ii) endfor endfunction
.endtemplate
— Reply to this email directly or view it on GitHub https://github.com/imatix/gsl/issues/64.
Hi @hintjens,
Thanks I appreciate, regarding your suggestion, I have no idea about the best place in the GSL repository to host them.
BTW, is there an easy way to add this new function as a builtin GSL function ? Maybe it could even be better to reimplement it in C code. What do you think ?
GSL uses .gxl files to build new classes in C, generating the hooks to plug that into the GSL main. It's not trivial though.
On Sat, Dec 13, 2014 at 10:13 AM, Caner Candan notifications@github.com wrote:
Hi @hintjens https://github.com/hintjens,
Thanks I appreciate, regarding your suggestion, I have no idea about the best place in the GSL repository to host them.
BTW, is there an easy way to add this new function as a builtin GSL function ? Maybe it could even be better to reimplement it in C code. What do you think ?
— Reply to this email directly or view it on GitHub https://github.com/imatix/gsl/issues/64#issuecomment-66870381.
Something that I am using quite a lot with my models is the ability to include XML files into others. I was usually doing it in hand-writing every time a GSL script to include a specific file (similarly to the example provided by the GSL guide) but honestly that sucks ;-) and I guess it's not in the MOP spirit. That's why I created a recursive function that includes every single node named
include
with an attributefile
.Here's an example of model in XML including other XML files:
script.gsl
:project.xml
:file1.xml
:file2.xml
:file3/file3.xml
:Here is the actual source code of the function:
Another solution could be to use the XInclude XML inclusion mechanism, here is the w3c rfc: http://www.w3.org/TR/xinclude/