Namespace definitions as code templates
Are you missing a feature? Request its implementation here.
			- 
				dcramer
 - Posts: 163
 - Joined: Sat Aug 28, 2010 1:23 am
 
Namespace definitions as code templates
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>- 
				adrian
 - Posts: 2894
 - Joined: Tue May 17, 2005 4:01 pm
 
Re: Namespace definitions as code templates
Hello,
Regards,
Adrian
			
			
									
									Note that it's currently possible to make a code template available for "All Editors" (first item in the list of "Associate with"). Currently, there are no other groups of editors, but we could accommodate some. I've logged a 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.
I've logged a feature request for this.#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:
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
						<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
- 
				dcramer
 - Posts: 163
 - Joined: Sat Aug 28, 2010 1:23 am
 
Re: Namespace definitions as code templates
It would be really cool if I could associate the code templates with namespaces, so if I'm in the xslt namespace, not matter what kind of document, I can use the xslt-related code templates. 
So if I'm editing an xproc file, I could use a code template to enter the following, and once I'm at ${caret}, I now have available all the usual xslt-related code templates:
			
			
									
									
						So if I'm editing an xproc file, I could use a code template to enter the following, and once I'm at ${caret}, I now have available all the usual xslt-related code templates:
Code: Select all
            <p:inline>
                <xsl:stylesheet
                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:xhtml="http://www.w3.org/1999/xhtml"
                    xmlns="http://docbook.org/ns/docbook"
                    exclude-result-prefixes="xhtml" version="2.0">
                    ${caret}
                </xsl:stylesheet>
            </p:inline>
			
				Jump to
				
			
		
			
			
	
	- Oxygen XML Editor/Author/Developer
 - ↳ Feature Request
 - ↳ Common Problems
 - ↳ DITA (Editing and Publishing DITA Content)
 - ↳ Artificial Intelligence (AI Positron Assistant add-on)
 - ↳ SDK-API, Frameworks - Document Types
 - ↳ DocBook
 - ↳ TEI
 - ↳ XHTML
 - ↳ Other Issues
 - Oxygen XML Web Author
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen Content Fusion
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen JSON Editor
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen PDF Chemistry
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen Feedback
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen XML WebHelp
 - ↳ Feature Request
 - ↳ Common Problems
 - XML
 - ↳ General XML Questions
 - ↳ XSLT and FOP
 - ↳ XML Schemas
 - ↳ XQuery
 - NVDL
 - ↳ General NVDL Issues
 - ↳ oNVDL Related Issues
 - XML Services Market
 - ↳ Offer a Service