use
vars
qw($VERSION @ISA)
;
BEGIN {
$VERSION
=
"1.0"
;
@ISA
=
qw(DynaLoader)
;
local
$DynaLoader::dl_dlext
=
"xs.$DynaLoader::dl_dlext"
if
(($^O eq
'MSWin32'
) && ($] ne
'5.010000'
));
bootstrap TurboXSLT
$VERSION
;
}
sub
new {
my
$class
=
shift
;
my
%options
=
@_
;
my
$self
=
bless
\
%options
,
$class
;
$self
->{TURBOXSL_GLOBAL_CONTEXT} = new XSLTGLOBALDATAPtr;
$self
->{TURBOXSL_CALLBACKS} = {};
return
$self
;
}
sub
EnableExternalCache {
my
$self
=
shift
;
my
$list
=
shift
;
_enable_external_cache(
$self
->{TURBOXSL_GLOBAL_CONTEXT},
$list
);
}
sub
AddURLRevision {
my
$self
=
shift
;
my
$url
=
shift
;
my
$revision
=
shift
;
_add_url_revision(
$self
->{TURBOXSL_GLOBAL_CONTEXT},
$url
,
$revision
);
}
sub
DefineGroupRights {
my
$self
=
shift
;
my
$library
=
shift
;
my
$group
=
shift
;
my
$actions
=
shift
;
_define_group_rights(
$self
->{TURBOXSL_GLOBAL_CONTEXT},
$library
,
$group
,
$actions
);
}
sub
LoadStylesheet {
my
$self
=
shift
;
my
$file
=
shift
;
return
new TurboXSLT::Stylesheet(
$self
->{TURBOXSL_GLOBAL_CONTEXT},
$file
);
}
sub
Parse {
my
$self
=
shift
;
my
$text
=
shift
;
return
_parse_str(
$self
->{TURBOXSL_GLOBAL_CONTEXT},
$text
);
}
sub
ParseFile {
my
$self
=
shift
;
my
$file
=
shift
;
return
_parse_file(
$self
->{TURBOXSL_GLOBAL_CONTEXT},
$file
);
}
sub
RegisterCallback {
my
$self
=
shift
;
my
$name
=
shift
;
my
$funp
=
shift
;
unless
(
$self
->{TURBOXSL_CALLBACKS}->{
$name
}) {
$self
->{TURBOXSL_CALLBACKS}->{
$name
} =
$funp
;
_register_callback(
$self
->{TURBOXSL_GLOBAL_CONTEXT},
$name
,
$funp
);
}
}
sub
Output {
my
$self
=
shift
;
my
$ctx
=
shift
;
my
$doc
=
shift
;
return
_output_str(
$ctx
,
$doc
);
}
sub
OutputFile {
my
$self
=
shift
;
my
$ctx
=
shift
;
my
$doc
=
shift
;
my
$file
=
shift
;
return
_output_file(
$ctx
,
$doc
,
$file
);
}
sub
SetVar {
my
$self
=
shift
;
my
$name
=
shift
;
if
(
defined
$name
&&
$name
ne
''
) {
my
$value
=
shift
||
''
;
setvarg(
$self
->{TURBOXSL_GLOBAL_CONTEXT},
$name
,
$value
);
}
else
{
warn
"usage: TurboXSLT->SetVar(name[,value])"
;
}
}
sub
AddHashVar {
my
$self
=
shift
;
my
$name
=
shift
;
my
$index
=
shift
;
my
$value
=
shift
;
$name
=
'@'
.
$name
.
'@'
.
$index
;
$self
->SetVar(
$name
,
$value
);
}
1;