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:24:56 -0000 |
On 27.07.2022 23:07, Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx wrote: > If the <!DOCTYPE> gives you a problem when you fiddle with this, you > could probably remove it and just play with the PI addition. Here is a fiddle <https://martin-honnen.github.io/xml-workbench/?code=%3C%3Fxml+version%3D%221 .0%22+encoding%3D%22UTF-8%22%3F%3E%0A%3Cxsl%3Astylesheet+xmlns%3Axsl%3D%22htt p%3A%2F%2Fwww.w3.org%2F1999%2FXSL%2FTransform%22%0A%09xmlns%3Axs%3D%22http%3A %2F%2Fwww.w3.org%2F2001%2FXMLSchema%22%0A%09exclude-result-prefixes%3D%22%23a ll%22%0A%09version%3D%223.0%22%3E%0A%0A%3Cxsl%3Amode+on-no-match%3D%22shallow -copy%22%2F%3E%0A%0A%3Cxsl%3Atemplate+match%3D%22%2F*%22%3E%0A%0A++%3Cxsl%3Ap rocessing-instruction+name%3D%22xml-model%22%3Ehref%3D%22urn%3Aoasis%3Anames% 3Atc%3Adita%3Arng%3Atopic.rng%22+schematypens%3Dhttp%3A%2F%2Frelaxng.org%2Fns %2Fstructure%2F1.0%3C%2Fxsl%3Aprocessing-instruction%3E%0A%0A++%3Cxsl%3Anext- match%2F%3E%0A%0A%3C%2Fxsl%3Atemplate%3E%0A++%0A%3C%2Fxsl%3Astylesheet%3E%0A& input=%3C%21DOCTYPE+html+PUBLIC+%22-%2F%2FW3C%2F%2FDTD+XHTML+1.0+Strict%2F%2F EN%22%0A+++%22http%3A%2F%2Fwww.w3.org%2FTR%2Fxhtml1%2FDTD%2Fxhtml1-strict.dtd %22%3E%0A%3Chtml+xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+lang%3D %22en%22+xml%3Alang%3D%22en%22%3E%0A%3Chead%3E%0A+%3Ctitle%3EMy+page+title%3C %2Ftitle%3E%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0 A&code-type=XSLT&input-type=XML> using the XHTML DOCTYPE instead, as Saxon has that internally in its resolver data. The result I get is e.g. <?xml version="1.0" encoding="UTF-8"?><?xml-model href="urn:oasis:names:tc:dita:rng:topic.rng" schematypens=http://relaxng.org/ns/structure/1.0?><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> B B <head> B B B B B <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> B B B B B <title>My page title</title> B B </head> B B <body></body> </html> so the PI is where you want it. I don't see why you would need <xsl:output doctype-system=""/>, the input DOCTYPE is not copied as it is not part of the XSLT/XPath data model. Above link spelled out is https://martin-honnen.github.io/xml-workbench/?code=%3C%3Fxml+version%3D%221. 0%22+encoding%3D%22UTF-8%22%3F%3E%0A%3Cxsl%3Astylesheet+xmlns%3Axsl%3D%22http %3A%2F%2Fwww.w3.org%2F1999%2FXSL%2FTransform%22%0A%09xmlns%3Axs%3D%22http%3A% 2F%2Fwww.w3.org%2F2001%2FXMLSchema%22%0A%09exclude-result-prefixes%3D%22%23al l%22%0A%09version%3D%223.0%22%3E%0A%0A%3Cxsl%3Amode+on-no-match%3D%22shallow- copy%22%2F%3E%0A%0A%3Cxsl%3Atemplate+match%3D%22%2F*%22%3E%0A%0A++%3Cxsl%3Apr ocessing-instruction+name%3D%22xml-model%22%3Ehref%3D%22urn%3Aoasis%3Anames%3 Atc%3Adita%3Arng%3Atopic.rng%22+schematypens%3Dhttp%3A%2F%2Frelaxng.org%2Fns% 2Fstructure%2F1.0%3C%2Fxsl%3Aprocessing-instruction%3E%0A%0A++%3Cxsl%3Anext-m atch%2F%3E%0A%0A%3C%2Fxsl%3Atemplate%3E%0A++%0A%3C%2Fxsl%3Astylesheet%3E%0A&i nput=%3C%21DOCTYPE+html+PUBLIC+%22-%2F%2FW3C%2F%2FDTD+XHTML+1.0+Strict%2F%2FE N%22%0A+++%22http%3A%2F%2Fwww.w3.org%2FTR%2Fxhtml1%2FDTD%2Fxhtml1-strict.dtd% 22%3E%0A%3Chtml+xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+lang%3D% 22en%22+xml%3Alang%3D%22en%22%3E%0A%3Chead%3E%0A+%3Ctitle%3EMy+page+title%3C% 2Ftitle%3E%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A &code-type=XSLT&input-type=XML
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] replacing <!DOCTYPE> with, Martin Honnen martin | Thread | Re: [xsl] replacing <!DOCTYPE> with, Chris Papademetrious |
Re: [xsl] replacing <!DOCTYPE> with, Martin Honnen martin | Date | Re: [xsl] replacing <!DOCTYPE> with, Chris Papademetrious |
Month |