XSD/XSLT namespaces - how to have the same file for development and production
I have stylesheets and schemas that uses namespaces
e.g.
<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:abc="ht开发者_Go百科tp://development.com">
But when placing them onto the production server I have to change the URL for the namespaces. Is there an easier way so I do not need to go through them and change the URLs? (i.e. just have one file that works both on the development and production platforms)
Namespaces use URLs as a convention to help ensure uniqueness (e.g. so that two different people designing XML languages to describe events end up with http://example.com/event
and http://example.net/event
instead of event
and event
).
There is a convention to put a document relating to the namespace (such as a schema, or a human readable specification) at that URL, but that is just a convention.
You should not have to change the identifier you use in the xmlns attribute between development and production. An XML application is an XML application as far as namespaces are concerned, they pay no heed to development and production. (e.g. All XHTML uses the same namespace, it doesn't matter if it is XHTML 1, XHTML 1.1, the XML serialisation of HTML 5 or something else).
So, in short:
Is there an easier way so I do not need to go through them and change the URLs?
Only ever use the production one. Don't have a development namespace in the first place.
精彩评论