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

Re: Transforming Locally Declared Namespaces into Glob

Subject: Re: Transforming Locally Declared Namespaces into Globally Declared Namespaces
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 1 Jul 2004 15:10:18 +0100
Re:  Transforming Locally Declared Namespaces into Glob
In theory all these things are equivalent according to the namespace rec
and so equivalent in the XPath data model and so you can not _force_
that xslt writes things one way or another: you coul just write an
identity transform and find that your XSLT system changes your document
from one style to the other.

that said, most systems don't arbitrarily change namespace prefixing
style just because they can, and do go to some effort to preserve what
they devine to be the author intention, 

so first of all you want to get some namespace nodes on to the top level
document element (this will _force_ namespace declarations of these
prefixes in the output, what you can't actually uses these prefixes).
easiest way of doing that is to declare them in the stylesheet.

<xsl:stylesheet ...
  xmlns:a="urn:a" xmlns:b="urn:b" xmlns:c="urn:c">

then in for your top level element
<xsl:template match="/a:a">
     <xsl:copy-of select="@*"/>

by using a literal element here you will get teh namespace nodes from
the stylesheet which you wouldn't get if you used xsl:element or

for everything else you want to force a prefix so

<xsl:template match="a:*">
 <xsl:element name="a:{local-name()}">
    <xsl:copy-of select="@*"/>

<xsl:template match="b:*">
 <xsl:element name="b:{local-name()}">
    <xsl:copy-of select="@*"/>



The LaTeX Companion

This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread


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.
First Name
Last Name
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.