[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Re: replacing <!DOCTYPE> with <?xml-model?> in XSLT
From: "Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Jul 2022 11:06:04 -0000
Re:  replacing <!DOCTYPE> with <?xml-model?> in XSLT
Hi Martin,

The processor is Saxon inside Oxygen; I am running this as an Oxygen
refactoring operation.

Oxygen compares the result against the input, then tries to minimize the diff
footprint due to serialization differences. I suspect this
bminimize-the-serialization-differencesb processing might be responsible
for me seeing a different behavior in Oxygen versus your fiddle.

Thank you for having a look!


  *   Chris


From: Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, July 27, 2022 5:25 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  replacing <!DOCTYPE> with <?xml-model?> in XSLT



On 27.07.2022 23:07, Chris Papademetrious
christopher.papademetrious@xxxxxxxxxxxx<mailto:christopher.papademetrious@syn
opsys.com> 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://urldefense.com/v3/__https:/martin-honnen.github.io/xml-workben
ch/?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*2FTransfor
m*22*0A*09xmlns*3Axs*3D*22http*3A*2F*2Fwww.w3.org*2F2001*2FXMLSchema*22*0A*09
exclude-result-prefixes*3D*22*23all*22*0A*09version*3D*223.0*22*3E*0A*0A*3Cxs
l*3Amode*on-no-match*3D*22shallow-copy*22*2F*3E*0A*0A*3Cxsl*3Atemplate*match*
3D*22*2F**A22*3E*0A*0A**B3Cxsl*3Aprocessing-instruction*name*3D*22xml-model*2
2*3Ehref*3D*22urn*3Aoasis*3Anames*3Atc*3Adita*3Arng*3Atopic.rng*22*schematype
ns*3Dhttp*3A*2F*2Frelaxng.org*2Fns*2Fstructure*2F1.0*3C*2Fxsl*3Aprocessing-in
struction*3E*0A*0A**B3Cxsl*3Anext-match*2F*3E*0A*0A*3C*2Fxsl*3Atemplate*3E*0A
**B0A*3C*2Fxsl*3Astylesheet*3E*0A&input=*3C*21DOCTYPE*html*PUBLIC**A22-*2F*2F
W3C*2F*2FDTD*XHTML*1.0*Strict*2F*2FEN*22*0A**C22http*3A*2F*2Fwww.w3.org*2FTR*
2Fxhtml1*2FDTD*2Fxhtml1-strict.dtd*22*3E*0A*3Chtml*xmlns*3D*22http*3A*2F*2Fww
w.w3.org*2F1999*2Fxhtml*22*lang*3D*22en*22*xml*3Alang*3D*22en*22*3E*0A*3Chead
*3E*0A**A3Ctitle*3EMy*page*title*3C*2Ftitle*3E*0A*3C*2Fhead*3E*0A*3Cbody*3E*0
A*0A*3C*2Fbody*3E*0A*3C*2Fhtml*3E*0A&code-type=XSLT&input-type=XML__;JSUrJSUl
KyUlJSUlJSUlKyUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUrJSUlJSUlJSUlK
yUlJSolJSUlKyslJSslJSUlJSUlJSUlJSUlKyUlJSUlJSUlJSUlJSUrKyUlJSUlJSUlJSUlKyslJS
UlJSUlJSsrKyUlJSUlKysrJSUlJSsrKyUlJSUlJSUlJSUlJSslJSUlJSUlJSslJSUrJSUlJSUlJSU
lKyUlKyslJSUlJSUlJSUlJSUlJSUlJSUlJQ!!A4F2R9G_pg!dZgU2GDrnDKksoc6n4ku85GJS9IvG
1l-Rh4NCbUWZoTc4-NQgm0LwV1qsWuYh6KLjg-QzoVwwv1LAdnIpT0nNgEvLA3mL216lUkQbXU6af
AqxuNdjRH4$> 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<https://urldefense.com/v3/__
http:/relaxng.org/ns/structure/1.0__;!!A4F2R9G_pg!dZgU2GDrnDKksoc6n4ku85GJS9I
vG1l-Rh4NCbUWZoTc4-NQgm0LwV1qsWuYh6KLjg-QzoVwwv1LAdnIpT0nNgEvLA3mL216lUkQbXU6
afAqxsy6afQ6$>?><html
xmlns="http://www.w3.org/1999/xhtml"<https://urldefense.com/v3/__http:/www.w3
.org/1999/xhtml__;!!A4F2R9G_pg!dZgU2GDrnDKksoc6n4ku85GJS9IvG1l-Rh4NCbUWZoTc4-
NQgm0LwV1qsWuYh6KLjg-QzoVwwv1LAdnIpT0nNgEvLA3mL216lUkQbXU6afAqxr80VPLX$>
lang="en" xml:lang="en">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <title>My page title</title>
   </head>
   <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<https://urldefense.com/v3/__https:/martin-honn
en.github.io/xml-workbench/?code=*3C*3Fxml*version*3D*221.0*22*encoding*3D*22
UTF-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*2F2
001*2FXMLSchema*22*0A*09exclude-result-prefixes*3D*22*23all*22*0A*09version*3
D*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**A22*3E*0A*0A**B3Cxsl*3Aprocessing-instructi
on*name*3D*22xml-model*22*3Ehref*3D*22urn*3Aoasis*3Anames*3Atc*3Adita*3Arng*3
Atopic.rng*22*schematypens*3Dhttp*3A*2F*2Frelaxng.org*2Fns*2Fstructure*2F1.0*
3C*2Fxsl*3Aprocessing-instruction*3E*0A*0A**B3Cxsl*3Anext-match*2F*3E*0A*0A*3
C*2Fxsl*3Atemplate*3E*0A**B0A*3C*2Fxsl*3Astylesheet*3E*0A&input=*3C*21DOCTYPE
*html*PUBLIC**A22-*2F*2FW3C*2F*2FDTD*XHTML*1.0*Strict*2F*2FEN*22*0A**C22http*
3A*2F*2Fwww.w3.org*2FTR*2Fxhtml1*2FDTD*2Fxhtml1-strict.dtd*22*3E*0A*3Chtml*xm
lns*3D*22http*3A*2F*2Fwww.w3.org*2F1999*2Fxhtml*22*lang*3D*22en*22*xml*3Alang
*3D*22en*22*3E*0A*3Chead*3E*0A**A3Ctitle*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&i
nput-type=XML__;JSUrJSUlKyUlJSUlJSUlKyUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJ
SUlJSUlJSUrJSUlJSUlJSUlKyUlJSolJSUlKyslJSslJSUlJSUlJSUlJSUlKyUlJSUlJSUlJSUlJS
UrKyUlJSUlJSUlJSUlKyslJSUlJSUlJSsrKyUlJSUlKysrJSUlJSsrKyUlJSUlJSUlJSUlJSslJSU
lJSUlJSslJSUrJSUlJSUlJSUlKyUlKyslJSUlJSUlJSUlJSUlJSUlJSUlJQ!!A4F2R9G_pg!dZgU2
GDrnDKksoc6n4ku85GJS9IvG1l-Rh4NCbUWZoTc4-NQgm0LwV1qsWuYh6KLjg-QzoVwwv1LAdnIpT
0nNgEvLA3mL216lUkQbXU6afAqxuNdjRH4$>
XSL-List info and
archive<https://urldefense.com/v3/__http:/www.mulberrytech.com/xsl/xsl-list__
;!!A4F2R9G_pg!dZgU2GDrnDKksoc6n4ku85GJS9IvG1l-Rh4NCbUWZoTc4-NQgm0LwV1qsWuYh6K
Ljg-QzoVwwv1LAdnIpT0nNgEvLA3mL216lUkQbXU6afAqxinLndKt$>
EasyUnsubscribe<https://urldefense.com/v3/__http:/lists.mulberrytech.com/unsu
b/xsl-list/3380743__;!!A4F2R9G_pg!dZgU2GDrnDKksoc6n4ku85GJS9IvG1l-Rh4NCbUWZoT
c4-NQgm0LwV1qsWuYh6KLjg-QzoVwwv1LAdnIpT0nNgEvLA3mL216lUkQbXU6afAqxmsCIT-J$>
(by email<>)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.