Re: [xsl] Versioned Namespaces

Subject: Re: [xsl] Versioned Namespaces
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 15 Jul 2010 10:26:45 +0100
On 15/07/2010 09:58, Andy Chambers wrote:
Hi,

I've developed a small library of re-usable functions for working with
an clinical data XML standard.  The
standard has been around for a while now and so there are multiple
versions of it, each one of which
has a slightly different namespace

http://www.cdisc.org/ns/odm/v1.2
http://www.cdisc.org/ns/odm/v1.3

are the two I work with most commonly.

My library was developed against v1.3 and so uses this for the
namespace but now I need to make it
work when operating on a v1.2 documents.  Is there a way to do this
without code duplication?

Cheers,
Andy


The usual advice is don't change namespaces ever. If you change the namespace then you have changed the name of every construct in the language so it's not a new version, it's a completely new language.
(See how xslt 1 and 2 have the same namespace, as does mathml 1 2 3 )


Despite that it is regrettably common that people do use namespace changes as versioning.

the simplest way to handle that in xslt is to write the main code just using one namespace (say the new one) and then handle any document in the old namespace by first processing it in a mode that uses a single modified identity template that just switches the namespace., save that result to a variable, then apply your main processing mode to this modified in memory document tree.

David


________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________


Current Thread