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

Re: Namespace declaration - good practise

  • From: "G. Ken Holman" <gkholman@CraneSoftwrights.com>
  • To: Christophe Marchand <cmarchand@oxiane.com>,"xml-dev@l..." <xml-dev@l...>
  • Date: Fri, 26 Apr 2019 12:37:36 -0400

Re:  Namespace declaration - good practise
Absolutely I've done this and I continue to do so. It is very convenient.

I had one stylesheet tree with over two dozen fragments (meaningfully separated by semantics and context, I wasn't doing it for the sake of doing it) and each fragment incorporated a set of namespace URI string general entities using the technique you show.

And I continue to use internal declaration subsets for the editing of large documents that have lots of re-use of integral strings. I take advantage of this in OASIS specification XML sources:

http://docs.oasis-open.org/ubl/os-UBL-2.2/UBL-2.2.xml

<!DOCTYPE article
PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"db/spec-0.7/docbook/docbookx.dtd"
[
<!-- the document properties-->
<!ENTITY name "UBL">
<!ENTITY pversion "NONE">
<!ENTITY version "2.2">
<!ENTITY stage "os">
<!ENTITY isostage "IS">
<!ENTITY stagetext "OASIS Standard">
<!ENTITY standard "OASIS Standard">
<!ENTITY this-loc "http://docs.oasis-open.org/ubl/&stage;-UBL-2.2">
<!ENTITY previous-loc "http://docs.oasis-open.org/ubl/cs01-UBL-2.2">
<!ENTITY latest-loc "http://docs.oasis-open.org/ubl">
<!ENTITY pubdate "09 July 2018"><!--remove time from pub date-->
<!ENTITY pubyear "2018">
<!ENTITY pubdate-iso "ccyy-mm-dd">
<!ENTITY reldate-iso "ccyy-mm">
]>
<article status="&standard;">
<articleinfo>
<productname>&name;</productname>
<productnumber>&version;</productnumber>
<releaseinfo role="track">Standards Track Work Product</releaseinfo>
<releaseinfo role="OASIS-specification-this">&this-loc;/&name;-&version;.html</releaseinfo>
<releaseinfo role="OASIS-specification-this" lang="none">&this-loc;/&name;-&version;.pdf</releaseinfo>
<releaseinfo role="OASIS-specification-this-authoritative" lang="none">&this-loc;/&name;-&version;.xml</releaseinfo>
<releaseinfo role="OASIS-specification-previous">&previous-loc;/UBL-&version;.html</releaseinfo>
<releaseinfo role="OASIS-specification-previous">&previous-loc;/UBL-&version;.pdf</releaseinfo>
<releaseinfo role="OASIS-specification-previous-authoritative">&previous-loc;/UBL-&version;.xml</releaseinfo>

. . . . . Ken

At 2019-04-26 16:17 +0200, Christophe Marchand wrote:
Content-Transfer-Encoding: 8bit

Hello !

I have a lot of XSL that process many business documents. Each XSL declares at least 15 different business namespaces, excluding technical namespaces (http://www.w3.org/1999/XSL/Transform, http://www.w3.org/2001/XMLSchema and so on).

We have problems when creating a new XSL, in copy/paste namespace declarations, and refactoring (namespace modification) is almost impossible.

So, I'd like to declare namespaces strings as constants, and use these constants in XSL.

The only way I've found is to declare a DTD with entities, one entity per namespace :

<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY nsXF "http://www.lefebvre-sarrut.eu/ns/xmlfirst">
<!ENTITY nsAdded "eu:lefebvre-sarrut:mcqueen:publication:added">
<!ENTITY nsXfPub "http://www.lefebvre-sarrut.eu/ns/xmlfirst/publication">
<!ENTITY nsEls "http://www.lefebvre-sarrut.eu/ns/els">

Then, use this DTD in my XSL :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet SYSTEM "../../namespaces.dtd">
<xsl:stylesheet
xmlns:xf="&nsXF;"
xmlns:added="&nsAdded;" ...>

Oxygen have a convinient completion on entities that simplifies declaration.

Am I the only guy to do this ?

Is it a good practise ?

Best regards,
Christophe

--
Contact info, blog, articles, etc. http://www.CraneSoftwrights.com/x/ |
Check our site for free XML, XSLT, XSL-FO and UBL developer resources |
Streaming hands-on XSLT/XPath 2 training class @ US$45 (5 hours free) |



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.