[Logo] LUA Форум
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
libxslt and lua  XML
Forum Index » LUA: WEB
Author Message
sarjsheff
ГУРУ
[Avatar]

Joined: 11/01/2008 23:09:00
Messages: 131
Location: Moscow
Offline

Написал функцию для транформации (libxslt) и биндинг к ней.

luaxslt.c:




lxslt.lua:



test.xslt:



Собираем:



Проверяем:

This message was edited 1 time. Last update was at 14/02/2008 15:10:20

bukaka
Новичок

Joined: 07/11/2009 22:58:18
Messages: 1
Offline

http://luaforge.net/projects/lua-template/

Посмотри библиотеку работы с шаблонами. подстановка переменных, повторяющиеся блоки, итд.

example:
$ cat > t.txt
Hello, my name is {name}!
I have a pets:
<!-- BEGIN pets -->{N}. {name}
<!-- END pets -->
^D
$ cat > t.lua
package.cpath = "../liblua-?.so;./?.dll"

require'template'

r = template.new()

r:from_file't.txt'

r.name = 'Jon Smith'
r:begin_block("pets")
r.N=1
r.name = 'Dasy'
r:end_block()

r:begin_block("pets")
r.N=2
r.name = 'Gosha'
r:end_block()

--r:show'out.txt' -- to file out.txt
r:show() -- to stdout
r:delete()
^D
$ lua t.lua
Hello, my name is Jon Smith!
I have a pets:
1. Dasy
2. Gosha
 
Forum Index » LUA: WEB
Go to:   
Powered by JForum 2.1.9 © JForum Team