xsl-list
[Top] [All Lists]

Optional namespace declaration in XML document

2006-02-28 08:52:41
Hi,
 
Is there any way to have one XSLT 1.0 stylesheet handle situations where the 
XML input has different namespace declarations? In particular, I want to be 
able to use the same stylesheet to parse data which (because the standard is 
still only loosely supported by the various packages that claim to support it) 
can contain different namespace declarations (or no declaration at all) in the 
XML file. For all intents and purposes, the data structure is the same, 
regardless of the namespace declared. For example the data might be:
 
<mydata xmlns="myns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="myns myns.xsd">
  <mydataitem>sample data</mydataitem>
 </mydata>

or
 
<mydata xmlns="otherns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="otherns otherns.xsd">
  <mydataitem>sample data</mydataitem>
</mydata>

or simply
 
<mydata>
  <mydataitem>sample data</mydataitem>
</mydata>

(it's possible I made a mistake there, as it is obviously fictitious data). I 
can think of ways to get around the problem, but it seems ludicrously 
complicated. Is there a simple solution? Cheers,
 
Enrique
 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>