NAME
XML::Template::Element::File - XML::Template plugin module for the file namespace.
SYNOPSIS
This XML::Template plugin module implements the file namespace tagset. The block namespace includes tags that handle XML files as well as arbitrary files.
CONSTRUCTOR
XML::Template::Element::Block inherits its constructor method, new
, from XML::Template::Element.
FILE TAGSET METHODS
include
This method implements the include element. It reads a file and if requested parses it. The following attributes are used:
- name
-
The name of the file to include. It can be an absolute file spec or a path relative to the include directory set for XML::Template::Element::File::Load.
- parse
-
If set to
true
, the document will be parsed. If set tofalse
, the raw text of the document will be read in unparsed. The default value istrue
.
list
This method implements the list element, which displays a file listing. The following attributes are used:
- src
-
The name of the directory in which to display a file listing.
- cols
-
The number of columns in the file listing.
foreach
XML::Template::Element::File is a subclass of XML::Template::Element::Iterator, so it inherits the foreach
method, which in conjunction with the iterator methods defined in this module, implements iteration through a list of files.
The following attributes are used:
- src
-
The name of the directory containing files to iterate through.
- var
-
The name of the variable, available in the content of this element, that contains the current file name.
For instance,
<file:foreach xmlns:file="http://syrme.net/xml-template/file/v1"
src="/home/jowaxman" var="file">
file ${file}
</file:foreach>
iterates through the files in the directory /home/jowaxman
and prints each one.
AUTHOR
Jonathan Waxman <jowaxman@bbl.med.upenn.edu>
COPYRIGHT
Copyright (c) 2002-2003 Jonathan A. Waxman All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.