(dsssl) XS: How do you handle namespace prefixes in attribute values in XSLT?

Subject: (dsssl) XS: How do you handle namespace prefixes in attribute values in XSLT?
From: Matt Seaborn <MSeaborn@xxxxxxxxxxxxx>
Date: Wed, 4 Dec 2002 16:58:56 -0000
Taking a wsdl file (only as an example, applies to any namespaces xml file)
which looks like this

<?xml version="1.0"?>
<definitions name="StockQuote"
targetNamespace="http://example.com/stockquote.wsdl";
xmlns:xsd1="http://example.com/stockquote.xsd";

...

<message name="GetLastTradePriceOutput">
<part name="body" element="xsd1:TradePrice"/>
</message>

and you wish to operate on it using XSLT.  If the prefix 'xsd1' is not used
in the QName of an element then when operating on the XML the 'xsd1' prefix
will be lost unless it is explicitly declared in the XSLT.  However as the
actual prefix of a namespace is considered irrelevant it cannot be known
before being given the XML document to transform. Assuming the namespace and
its prefix is not known in advance and therefore not declared in the XSLT
the prefix-namespace association will not be present in the destination
document which renders the attribute value 'xsd1:TradePrice' incorrect if it
is placed in the destination (transformed) docoument.

How should this be handled, as I cannot see how to either preseve the
prefix-namespace declaration or ensure the namespace is declared and change
the prefix to a correct value in the attribute in the destination document?


Matt Seaborn
Software Engineer
Categoric Software 
The leader in business process event management technology 
+44 (0)1932 590900 tel
+44 (0)1932 590901 fax
+44 (0)1932 590907 direct
http://www.categoric.com

 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist

Current Thread