in reply to XML Parsing in a "mixed content" file

Why don't you just fill the template with template strings? What I mean is you fill up the storage holder of the template with stuff like:

# This is free hand, please ignore typos: my $templateContents = { hosts => { name = '[% host.name %]', }, ... }

I'm sure that you can find something that will nicely display the resulting XML file on a HTML page

edit: I have created a better example below

use strict ; use warnings ; use Template ; my $file = 'template.xml.tt'; my $vars = { hosts => [ { name => "[% host.name %]", } ], }; my $template = Template->new(); $template->process($file, $vars) || die "Template process failed: ", $template->error(), "\n" ;

I took only a part of your example template file:

<?xml version="1.0" encoding="ISO-8859-1"?> <workbook> <worksheet name="[% config.template %]"><format color="black"> [% FOREACH host IN hosts %] <row><bold><format color="white" size="14" bg_color="blue"><cell w +idth="60" text="Configuring de : [% host.name %]" /></format></bold>< +/row> [% END %] </worksheet> </workbook>

Of course it leaves out each of the FOREACH statements, but it basically gives you the freedom to fill in anything you want to show to your users, to show them which fields are automatically generated for them

The output would look like this:

<workbook> <worksheet name=""><format color="black"> <row><bold><format color="white" size="14" bg_color="blue"><cell w +idth="60" text="Configuring de : [% host.name %]" /></format></bold>< +/row> </worksheet> </workbook>