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

Re: with or without namespace

Subject: Re: with or without namespace
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Tue, 16 Nov 2010 19:50:41 +0000
Re:  with or without namespace
Rather than cluttering a stylesheet with conditional logic to handle two different input variants, it's almost always better to configure a pipeline in which you first (where necessary) convert the less common variant to the more common, and then do the real transformation work on normalized input.

One benefit is that the "normalizing" stylesheet is highly re-usable.

Michael Kay
Saxonica

On 16/11/2010 17:33, ac wrote:
Hi,

I have a xslt2 stylesheet that transforms to (x)html, an XML document type that comes in two flavors, both with the same "local-name" elements, but with or without namespace.

For example, either:

... xmlns:xx="aaa.cc">
<xx:a>
<xx:b>bla</xx:b>
</xx:a>
...

or

...>
<a>
<b>bla</b>
</a>
...

To process these elements irrespective of their namespace, I can use expressions like
*[local-name(.) = "a"] and *[local-name(.) = "b"]
all through the stylesheet but, in the stylesheet, I would much rather map everything to the same namespace (possibly to default- or no-namespace) and either use a single prefix, or better still, no prefix, all over the stylesheet, to refer to all or any of these elements.
/xx:a, /xx:b, or /a , /b, for example
What would be the best way to declare the stylesheet namespaces to achieve this, if possible?


Thank you,
ac

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.