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

RE: Optional namespace declaration in XML document

Subject: RE: Optional namespace declaration in XML document
From: "Fraser Goffin" <goffinf@xxxxxxxxxxx>
Date: Mon, 01 May 2006 15:38:46 +0100
RE:  Optional namespace declaration in XML document
Catching up on reading XSl-list digest I came across this one (from Marh 1st digest !) :-

Is there any way to have one XSLT 1.0 stylesheet handle situations where the XML input has different namespace declarations?

Possible solutions were offered by MK and Ken Holman, but neither mentioned the potential use of local-name(). Admittedly this may be inefficient or the document to be processed may be so complex that it may not be practical, but for simple situations it would be ok wouldn't it ?


The example docs were :-

<mydata xmlns="urn:myns">
	<mydataitem>sample data</mydataitem>
</mydata>

<mydata xmlns="urn:otherns">
	<mydataitem>sample data</mydataitem>
</mydata>

<mydata>
	<mydataitem>sample data</mydataitem>
</mydata>

Wouldn't something like this do ?? :-

<xsl:template match="*[local-name(.) = 'mydata']">
...

<xsl:template match="*[local-name(.) = 'mydataitem']">
...

We use something similar on complex documents where only the top level element is declared as a global type and thus has a namespace affiliation, all other types are local (and the schema declares elementFormDefault='unqualified').

Fraser.

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.