Namespace definitions as code templates
Posted: Wed Oct 11, 2017 8:54 pm
I'm a big fan of code templates and of course we all love namespaces. I notice that there's already a code template for the xsl namespace that's limited to the xslt editor. That's cool, but...
Feature request #1: It should really be possible to define a code template as being for all xml editors (xml, xslt, xproc, schematron, etc). I'm unlikely to need an code template for xmlns:xsl in the xslt editor since I probably created the xslt from a document template which defines that on the root element. I AM likely to need to insert an xsl namespace definition in an xproc pipeline or schematron.
Feature request #2: Add out-of-the-box code templates for all the common namespaces. I would suggest making the renderString for all of them start with the same letters so that they'll be grouped together in the list and won't clutter things up as much:
xnssvg => xmlns:svg="http://www.w3.org/2000/svg"
xnsxproc => xmlns:p="http://www.w3.org/ns/xproc"
xnsxprocstep => xmlns:c="http://www.w3.org/ns/xproc-step"
xnsfo => xmlns:fo="http://www.w3.org/1999/XSL/Format"
xnsxi => xmlns:xi="http://www.w3.org/2001/XInclude"
xnsxs => xmlns:xs="http://www.w3.org/2001/XMLSchema"
xnsdb => xmlns:db="http://docbook.org/ns/docbook"
and so on.
I defined two, nsdb and nsdbd, one to define xmlns:db and the other to insert xmlns="http://docbook.org/ns/docbook" for when I want to use it as the default namespace:
Feature request #1: It should really be possible to define a code template as being for all xml editors (xml, xslt, xproc, schematron, etc). I'm unlikely to need an code template for xmlns:xsl in the xslt editor since I probably created the xslt from a document template which defines that on the root element. I AM likely to need to insert an xsl namespace definition in an xproc pipeline or schematron.
Feature request #2: Add out-of-the-box code templates for all the common namespaces. I would suggest making the renderString for all of them start with the same letters so that they'll be grouped together in the list and won't clutter things up as much:
xnssvg => xmlns:svg="http://www.w3.org/2000/svg"
xnsxproc => xmlns:p="http://www.w3.org/ns/xproc"
xnsxprocstep => xmlns:c="http://www.w3.org/ns/xproc-step"
xnsfo => xmlns:fo="http://www.w3.org/1999/XSL/Format"
xnsxi => xmlns:xi="http://www.w3.org/2001/XInclude"
xnsxs => xmlns:xs="http://www.w3.org/2001/XMLSchema"
xnsdb => xmlns:db="http://docbook.org/ns/docbook"
and so on.
I defined two, nsdb and nsdbd, one to define xmlns:db and the other to insert xmlns="http://docbook.org/ns/docbook" for when I want to use it as the default namespace:
Code: Select all
<codeTemplateItem-array>
<codeTemplateItem>
<field name="contentType">
<String>text/any</String>
</field>
<field name="unparsedInsertString">
<String>xmlns="http://docbook.org/ns/docbook"${caret}</String>
</field>
<field name="descriptionString">
<String>Make DocBook the default namespace</String>
</field>
<field name="renderString">
<String>xnsdbd</String>
</field>
<field name="enabled">
<Boolean>true</Boolean>
</field>
<field name="accelerator">
<null/>
</field>
</codeTemplateItem>
<codeTemplateItem>
<field name="contentType">
<String>text/any</String>
</field>
<field name="unparsedInsertString">
<String>xmlns:db="http://docbook.org/ns/docbook"${caret}</String>
</field>
<field name="descriptionString">
<String>Define DocBook namespace as db:</String>
</field>
<field name="renderString">
<String>xnsdb</String>
</field>
<field name="enabled">
<Boolean>true</Boolean>
</field>
<field name="accelerator">
<null/>
</field>
</codeTemplateItem>