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

recreate the content in HTML format

Is that a static html file or dynamically with a script (like cgi) ?

Update - Are you looking for something as simple as this ?

#!perl use strict; use HTML::Entities; open OUT,'>', 'template.html' or die "$!"; print OUT '<html><body><pre>'; while (<DATA>){ print OUT encode_entities($_); } print OUT '</pre></html>'; __DATA__ <?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> <row /> [% FOREACH int IN host.interfaces %] <row><cell text="interface ip-bundle [% int.bundle %].[% int.subBu +ndle %]" /></row> [% FOREACH ip IN int.secondaries %] <row><cell text=" ip address [% ip.ipAddress %] [% ip.subnetMask % +] [% bits(ip.ipAddress,ip.subnetMask) %] secondary" /></row> [% END %] <row><cell text="!"/></row> [% END %] <row /> <row><bold><format color="white" size="14" bg_color="blue"><cell t +ext="END OF : [% host.name %]" /></format></bold></row> <row /><row /><row /> [% END %] </format> </worksheet> </workbook>
poj

Replies are listed 'Best First'.
Re^2: XML Parsing in a "mixed content" file
by llarochelle (Beadle) on Jan 11, 2019 at 18:51 UTC

    Hello poj, this would be static. I have built different templates and I want to display them in an elegant manner through a web page.

    What you suggested is nice, but what I really wanted to do (mostly) was extract content from "cell.text" ( and some other tags ) + the TT instructions and reformat the whole as an HTML document and apply some format. And I'm really thinking it would be easier to just write a regex for the purpose and recreate an HTML document from capture groups.