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

How do you handle namespace prefixes in attribute valu

Subject: How do you handle namespace prefixes in attribute values in XSLT?
From: Matt Seaborn <MSeaborn@xxxxxxxxxxxxx>
Date: Thu, 5 Dec 2002 08:44:30 -0000
handle namespace xml
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 <http://www.categoric.com/> 


 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

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