Subject: Re: [xsl] How to retain the end tag when outputting an empty element? From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 17 Jun 2022 21:10:24 -0000 |
> Using this (admittedly simplified) theory of XML processing, though, the answer to bhow to get <duck></duck> instead of <duck/>b is > $ perl -pe 's,<([A-Za-z][A-Za-z0-9._-]+)/>,<$1></$1>,g;' < INPUT.xml > OUTPUT.xml > or similar. > And, like all attempts to process XML using regular expressions, it is of course wrong. - It won't match an empty element tag that contains whitespace or attributes - It will match things that aren't empty element tags, because they occur in comments or CDATA. So if you have a document with a comment that says: <!-- The code below changes <x/> to <x></x> --> then be prepared for your comments to be garbled. Michael Kay Saxonica
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to retain the end tag, David Carlisle d.p.c | Thread | Re: [xsl] How to retain the end tag, Peter Flynn peter@xx |
Re: [xsl] How to retain the end tag, David Carlisle d.p.c | Date | Re: [xsl] How to retain the end tag, Peter Flynn peter@xx |
Month |