Re: [xsl] replacing <!DOCTYPE> with <?xml-model?> in XSLT

Subject: Re: [xsl] replacing <!DOCTYPE> with <?xml-model?> in XSLT
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 27 Jul 2022 21:16:22 -0000
On 27.07.2022 23:07, Chris Papademetrious
christopher.papademetrious@xxxxxxxxxxxx wrote:
>
>
> Given the following XML input:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
>
> <topic id="topic">
>
> B  <title>My Topic</title>
>
> </topic>
>
> I would like to replace <!DOCTYPE> with <?xml-model?>. With the following:
>
> <!-- remove the <!DOCTYPE> (works!) -->
>
> <xsl:output doctype-system=""/>
>
> <!-- add the <?xml-model?> (does not work) -->
>
> <xsl:template match="/*">
>
> B  <xsl:processing-instruction
> name="xml-model">href="urn:oasis:names:tc:dita:rng:topic.rng"
>
schematypens=http://relaxng.org/ns/structure/1.0</xsl:processing-instruction>
>
> B  <xsl:next-match/>
>
> </xsl:template>
>
> the <!DOCTYPE> removal works but the <?xml-model?> addition does not.
> Is there a trick to emitting a PI before the root element?
>

In which environment, what is the processor you are you trying? And what
happens if it doesn't work, any error?

Current Thread