[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: "Winchel \"Todd\" Vincent III" <winchel@xxxxxxxxxxxxxx>
Date: Thu, 1 Jul 2004 14:25:49 -0400
xsl change namespace
David:

Thank you for your response and time.

What you write makes sense to me and gives me a path to a solution that will
work for us.

I had hoped for a more generic solution because we are working with
arbitrary schema.  So, for example, the a, b, c in my example could be x, y,
z . . . or any other combination.  This having been said, what you wrote
gives me an idea on how we can create something that will work for us.

In particular, I was not aware of the following, which is very helpful:

> 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
> xsl:copy

Thanks very much,

Todd



----- Original Message ----- 
From: "David Carlisle" <davidc@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, July 01, 2004 10:10 AM
Subject: Re:  Transforming Locally Declared Namespaces into Globally
Declared Namespaces


>
> 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">
>   <a:a>
>      <xsl:copy-of select="@*"/>
>     <xsl:apply-templates/>
>   </a:a>
> </xsl:template>
>
> 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
> xsl:copy
>
> 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:apply-templates/>
>  </xsl:element>
> </xsl:template>
>
> <xsl:template match="b:*">
>  <xsl:element name="b:{local-name()}">
>     <xsl:copy-of select="@*"/>
>     <xsl:apply-templates/>
>  </xsl:element>
> </xsl:template>
>
> etc.
>
> David
>
>
> -- 
> The LaTeX Companion
>   http://www.awprofessional.com/bookstore/product.asp?isbn=0201362996
>
http://www.amazon.co.uk/exec/obidos/tg/detail/-/0201362996/202-7257897-0619804
>
>
> ________________________________________________________________________
> 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:
> http://www.star.net.uk
> ________________________________________________________________________
>
> --+------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxxxxxxxx>
> --+--
>
>



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.