XML / Style Files
XML Files
All HTML / XML files are run through the lonxml handler before
being served to a user. This allows us to rewrite many portion
of a document and to support serverside tags. There are 2 ways
to add new tags to the xml parsing engine, either through
LON-CAPA style files or by writing Perl tag handlers for the
desired tags.
Global Variables
-
$Apache::lonxml::debug - debugging control
-
@Apache::lonxml::pwd - path to the directory containing the file currently being processed
-
@Apache::lonxml::outputstack
$Apache::lonxml::redirection - these two are used for
capturing a subset of the output for later processing, don't
touch them directly use &startredirection and &endredirection
-
$Apache::lonxml::import - controls whether the
<import> tag actually does anything
-
@Apache::lonxml::extlinks - a list of URLs that the
user is allowed to look at because of the current resource
(images, and links)
-
#Apache::lonxml::metamode - some output is turned off,
the meta target wants a specific subset, use <output> to
guarentee that the catianed data will be in the parsing output
-
#Apache::lonxml::evaluate - controls whether
run::evaluate actually derefences variable references
-
%Apache::lonxml::insertlist - data structure for edit
mode, determines what tags can go into what other tags
-
@Apache::lonxml::namespace - stores the list of tag
namespaces used in the insertlist.tab file that are currently
active, used only in edit mode.
-
$Apache::lonxml::registered - set to 1 once the remote
has been updated to know what resource we are looking at.
-
$Apache::lonxml::request - current Apache request
object, or undef
Notable Perl subroutines
If not specified these functions are in Apache::lonxml
-
xmlparse - see the XMLPARSE figure
-
recurse - acts just like xmlparse, except it
doesn't do the style definition check it always calls
callsub
-
callsub - callsub looks if a perl subroutine is defined
for the current tag and calls. Otherwise it just returns the
tag as it was read in. It also will throw on a default editing
interface unless the tag has a defined subroutine that either
returns something or requests that call sub not add the
editing interface.
-
afterburn - called on the output of xmlparse, it can
add highlights, anchors, and links to regular expersion
matches to the output.
-
register_insert - builds the
%Apache::lonxml::insertlist structure of what tags can have
what other tags inside.
-
whichuser - returns a list of $symb, $courseid,
$domain, $name that is correct for calls to lonnet functions
for this setup. Uses form.grade_ parameters, if the user is
allowed to mgr in the course
Functions Tag Handlers can use
If not specified these functions are in Apache::lonxml
Style Files
Style File specific tags
-
<definetag> - 2 arguments, name name of
new tag being defined, if proceeded with a / defining an end
tag, required; parms parameters of the new tag, the
value of these parameters can be accesed by $parametername.
-
<render> - define what the new tag does for a non meta target
-
<meta> - define what the new tag does for a meta target
-
<tex> / <web> / <latexsource> -
define what a new tag does for a specific no meta target, all
data inside a <render> is render to all targets except
when surrounded by a specific target tags.
Guy Albertelli
Last modified: Thu May 23 17:19:29 EDT 2002