summaryrefslogtreecommitdiff
path: root/tex/context/base/lxml-ini.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/lxml-ini.lua')
-rw-r--r--tex/context/base/lxml-ini.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/tex/context/base/lxml-ini.lua b/tex/context/base/lxml-ini.lua
new file mode 100644
index 000000000..f2a42eeea
--- /dev/null
+++ b/tex/context/base/lxml-ini.lua
@@ -0,0 +1,33 @@
+if not modules then modules = { } end modules ['lxml-ini'] = {
+ version = 1.001,
+ comment = "companion to lxml-ini.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+document = document or { }
+document.xml = document.xml or { }
+
+lxml = { }
+lxml.loaded = { }
+
+function lxml.root(id)
+ return lxml.loaded[id]
+end
+
+function lxml.load(id,filename)
+ lxml.loaded[id] = xml.load(filename)
+end
+
+function lxml.first(id,pattern)
+ tex.sprint(xml.tostring(xml.first_text(lxml.loaded[id],pattern)))
+end
+
+function lxml.last(id,pattern)
+ tex.sprint(xml.tostring(xml.last_text (lxml.loaded[id],pattern)))
+end
+
+function lxml.index(id,pattern,i)
+ tex.sprint(xml.tostring(xml.index_text(lxml.loaded[id],pattern,i)))
+end