-module(xserl_test).
-include("xmerl.hrl").
-import(xserl,[ xslapply/2, value_of/1, select/2, built_in_rules/2 ]).
-export([process_xml/1,test/0]).
doctype()->
"".
test() ->
Str= ""
" "
"This is a funny book!"
"
", xslapply( fun template/1, E), "
"]; template(E = #xmlElement{ name='note'}) -> ["" "NOTE: ", xslapply( fun template/1, E), "
"]; template(E = #xmlElement{ name='emph'}) -> ["", xslapply( fun template/1, E), ""]; template(E)-> built_in_rules( fun template/1, E). %% It is important to end with a call to xserl:built_in_rules/2 %% if you want any text to be written in "push" transforms. %% That are the ones using a lot xslapply( fun template/1, E ) %% instead of value_of(select("xpath",E)), which is pull... %% Could maybe be caught as an exception in xslapply instead, %% but I think that could degrade performance - having an %% exception for every #xmlText element.