Plankton has asked for the wisdom of the Perl Monks concerning the following question:
... I know that looks like hell in code tags but I hope it looks better if you click dl/code link :)<?xml version="1.0"?> | <!DOCT +YPE book PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [ <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//E | <!ENTI +TY nwalsh "Norman Walsh"> "/usr/share/sgml/docbook/xml-dtd-4.2-1.0-17/docbookx.dtd"> | ]> <article> | <book> <articleinfo> | + <bookinfo> <title>sudo Use and Administration on RH9</ti + <title>sudo Use and Administration on RH9</ti </articleinfo> | + </bookinfo> > <artic +le> <sect1> <title>Introduction</title> <para> + <sect1> <title>Introduction</title> <para> This document describes how to use and administor sudo on RH9 This d +ocument describes how to use and administor sudo on RH9 </para><para> + </para><para> blah blah ... </sect1> + </sect1> </article> </arti +cle> > </book +>
#!/usr/bin/perl -w use strict; my $DTD_VER = "4.2" + + my $firstLine = <>; + + print $firstLine if $firstLine !~ /^\<\?xml/; while(<>) { s/artlicle/book/g; s/DocBook XML V\d\.\d\.\d/DocBook V$DTD_VER/g; ... print $_; } print "</book>\n";
| Plankton: 1% Evil, 99% Hot Gas. |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML to SGML or xsl vs DTD confused
by iburrell (Chaplain) on Aug 12, 2004 at 18:15 UTC | |
by Plankton (Vicar) on Aug 12, 2004 at 20:35 UTC | |
by hsinclai (Deacon) on Aug 12, 2004 at 22:24 UTC |