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

Re: Namespace declaration - good practise

  • From: Hans-Juergen Rennau <hrennau@yahoo.de>
  • To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>, Christophe Marchand <cmarchand@o...>
  • Date: Fri, 26 Apr 2019 14:55:18 +0000 (UTC)

Re:  Namespace declaration - good practise
Hi Christophe, I regard DTD as an anachronism - unrelated to modern XML technology (XSD, XPath, XQuery, XSLT) and without future - which I would avoid.

How about writing a tool with the following functionality:
* input: one or more XML files (e.g. XSLTs)
* optional parameter: $ignore - a whitespace-separated list of prefixes identifying namespaces to be ignored
* optional parameter: $add - a whitespace-separated list of prefix/uri pairs to be added
* optional parameter: $upgrade - an XSLT to be modified, see below
* output:
* if no $upgrade: an empty XSLT document with namespace declarations echoing the namespace declarations of the input files
* if $upgrade: a copy of $upgrade, which has namespace declarations echoing the namespace declarations of the input files

The XPath function fn:in-scope-prefixes() and fn:namespace-uri-for-prefix() allow a straightforward copying of in-scope namespaces.

Kind regards,
Hans

Am Freitag, 26. April 2019, 16:17:16 MESZ hat Christophe Marchand <cmarchand@oxiane.com> Folgendes geschrieben:


Hello !

I have a lot of XSL that process many business documents. Each XSL
declares at least 15 different business namespaces, excluding technical

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 nsAdded "eu:lefebvre-sarrut:mcqueen:publication:added">

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


_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/



[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.