Exporting XML with a relaxNG declaration
Friday, 1 July 2022 · 3 messages
FB
France Baril1 Jul 2022 12:39 #
Hi,
I am trying to output XML with a link to a RelaxNG schema without success.
- It works with DTDs using doctype-public and doctype-systems in the serialization params of
file:write
- It works with .xsd because the declaration is in the attribute
- For relaxNg, the intro line looks like a PI, but I can't seem to be able to keep PIs when outputting xml with file:write
Specifically:
let $map-params := map {
'method': 'xml',
'indent': 'no',
'omit-xml-declaration': 'no'
}let $map := (
<?xml-model href="urn:oasis:names:tc:dita:rng:map.rng"
schematypens="http://relaxng.org/ns/structure/2.x"?>,
<map>
<?test name="abc"?>
<title>{lower-case($spez/child::*[name()='name']/text())}</title>{
<title>{lower-case($spez/child::*[name()='name']/text())}</title>{
...
}</map>
)
return
file:write($dir-path || '/spec-' ||
lower-case($spez/child::*[name()='name']/text()) || '.ditamap', $map)gets me:
<map>
<title>Tests for elements - version 2.0</title>
...
</map>Both the declaration and the in-content test pi disappear.
What am I missing here?
--
France Baril
Architecte documentaire / Documentation architect
france.baril at architextus.com
IL
Imsieke, Gerrit, le-tex1 Jul 2022 12:59 #
Hi France,
This seems to work:
let $map := (
processing-instruction xml-model
{'href="urn:oasis:names:tc:dita:rng:map.rng"
schematypens="http://relaxng.org/ns/structure/2.x"'},
<map>
{processing-instruction test {'name="abc"'}}
<title>…</title>
<title>…</title>
</map>
)
return …Gerrit
Quoted text · France Baril · 60 lines
On 01.07.2022 12:39, France Baril wrote: > Hi, > > I am trying to output XML with a link to a RelaxNG schema without success. > > * It works with DTDs using doctype-public and doctype-systems in the > serialization params of file:write > * It works with .xsd because the declaration is in the attribute > * For relaxNg, the intro line looks like a PI, but I can't seem to be > able to keep PIs when outputting xml with file:write > > Specifically: > > let $map-params := map { > 'method': 'xml', > 'indent': 'no', > 'omit-xml-declaration': 'no' > } > > let $map := ( > <?xml-model href="urn:oasis:names:tc:dita:rng:map.rng" > schematypens="http://relaxng.org/ns/structure/2.x > <http://relaxng.org/ns/structure/2.x>"?>, > <map> > <?test name="abc"?> > > <title>{lower-case($spez/child::*[name()='name']/text())}</title>{ > > <title>{lower-case($spez/child::*[name()='name']/text())}</title>{ > ... > }</map> > ) > return > file:write($dir-path || '/spec-' || > lower-case($spez/child::*[name()='name']/text()) || '.ditamap', $map) > > > gets me: > > <map> > <title>Tests for elements - version 2.0</title> > ... > </map> > > > Both the declaration and the in-content test pi disappear. > > What am I missing here? > > > > > > > > > -- > France Baril > Architecte documentaire / Documentation architect > france.baril at architextus.com <mailto:france.baril at architextus.com>
--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsieke at le-tex.de, http://www.le-tex.de
Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930
Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt
FB
France Baril1 Jul 2022 14:57 #
Yep, the problem was 22 inches in front of the screen on that one. I was looking in a different output folder. Doh!
Quoted text · le-tex · 96 lines
On Fri, Jul 1, 2022 at 11:59 AM Imsieke, Gerrit, le-tex < gerrit.imsieke at le-tex.de> wrote: > Hi France, > > This seems to work: > > let $map := ( > processing-instruction xml-model > {'href="urn:oasis:names:tc:dita:rng:map.rng" > schematypens="http://relaxng.org/ns/structure/2.x"'}, > <map> > {processing-instruction test {'name="abc"'}} > <title>…</title> > <title>…</title> > </map> > ) > return … > > Gerrit > > On 01.07.2022 12:39, France Baril wrote: > > Hi, > > > > I am trying to output XML with a link to a RelaxNG schema without > success. > > > > * It works with DTDs using doctype-public and doctype-systems in the > > serialization params of file:write > > * It works with .xsd because the declaration is in the attribute > > * For relaxNg, the intro line looks like a PI, but I can't seem to be > > able to keep PIs when outputting xml with file:write > > > > Specifically: > > > > let $map-params := map { > > 'method': 'xml', > > 'indent': 'no', > > 'omit-xml-declaration': 'no' > > } > > > > let $map := ( > > <?xml-model href="urn:oasis:names:tc:dita:rng:map.rng" > > schematypens="http://relaxng.org/ns/structure/2.x > > <http://relaxng.org/ns/structure/2.x>"?>, > > <map> > > <?test name="abc"?> > > > > <title>{lower-case($spez/child::*[name()='name']/text())}</title>{ > > > > <title>{lower-case($spez/child::*[name()='name']/text())}</title>{ > > ... > > }</map> > > ) > > return > > file:write($dir-path || '/spec-' || > > lower-case($spez/child::*[name()='name']/text()) || '.ditamap', $map) > > > > > > gets me: > > > > <map> > > <title>Tests for elements - version 2.0</title> > > ... > > </map> > > > > > > Both the declaration and the in-content test pi disappear. > > > > What am I missing here? > > > > > > > > > > > > > > > > > > -- > > France Baril > > Architecte documentaire / Documentation architect > > france.baril at architextus.com <mailto:france.baril at architextus.com> > > -- > Gerrit Imsieke > Geschäftsführer / Managing Director > le-tex publishing services GmbH > Weissenfelser Str. 84, 04229 Leipzig, Germany > Phone +49 341 355356 110, Fax +49 341 355356 510 > gerrit.imsieke at le-tex.de, http://www.le-tex.de > > Registergericht / Commercial Register: Amtsgericht Leipzig > Registernummer / Registration Number: HRB 24930 > > Geschäftsführer / Managing Directors: > Gerrit Imsieke, Svea Jelonek, Thomas Schmidt >
--
France Baril
Architecte documentaire / Documentation architect
france.baril at architextus.com
Written for BaseX 9.7. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery