[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Copy DTD with XSLT

Subject: [xsl] Copy DTD with XSLT
From: Jesper Tverskov <jesper@xxxxxxxxxxx>
Date: Thu, 22 Aug 2013 10:43:25 +0200

Hi list

Back in 2008 I made a monster of an analayze-string regex exercise in
order to copy a DTD (declaration and internal subset) with XSLT.


It was part of my even bigger exercise: trying to make a true identity
transformation that recreates it all exactly as it was, including XML
Declaration and DTD, CDATA sections, character entities, whitespace
only text nodes, etc.

If the DTD subset is nasty, I found it almost impossible to locate the
last "gt" delimiter of the DTD. I remember how David Carlisle always
managed to come up with some new absurd DTD subset for testing that
would  break my code. But finally I had my 100% solution in place but
with code so far out that you don't want to show it to your neighbour
(I could probably make it a little better today). I used not just
REGEX but all sorts of string manipulations, replacement characters,
you name it.

Here is my question:

Have I overlooked some nice new extension function, that might have
appeared since then, that can make a copy of a DTD using XSLT? The DTD
Declaration and the internal subset if it exists?

Or can some REGEX and string manipulation expert, please, show me a
nice and easy way to copy a DTD with XSLT, so I can drop my own
primitive solution.

Current Thread