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

RE: adding a namespace to a stylesheet automatically

Subject: RE: adding a namespace to a stylesheet automatically
From: "Lars Huttar" <lars_huttar@xxxxxxx>
Date: Wed, 29 Oct 2003 12:58:31 -0600
local name stylesheet
> Hi
> 
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> > Lars Huttar
> > Sent: Wednesday, October 29, 2003 12:05 AM
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: RE:  adding a namespace to a stylesheet automatically
> > 
> > 
> > > This is of course the scenario that motivated
> > > xpath-default-namespace in
> > > XSLT 2.0.
> > > 
> > > Michael Kay
> > 
> > Yes. I'm wondering if anyone has written a solution to make 
> > do for XSLT 1.0.
> 
> You can use local-name() ans namespace-uri()
> 
>  <xsl:template match="*[local-name()='foo' and
> namespace-uri()=$mynamespace]">
>    <xsl:if test="parent::*[local-name()='bar' and
> namespace-uri()=$mynamespace][@baz] = /*/*[local-name()='squid' and
> namespace-uri()=$mynamespace]">...</xsl:if>
> 
> 
> Just define $mynamespace as a global parameter. Every time you change
> namespaces you only need ta pass the new one to the stylesheet
> 
> Regards,
> Americo Albuquerque

Thanks.
I think for this kind of thing it would be just as easy
to just put in a namespace prefix where needed, and when
I want to change the namespace, just change the declaration
of that prefix in the stylesheet; or if required, do a global-replace
in my text editor to change "foo:" to "bar:".

What I'm looking for is a way to avoid the tedious and error-prone
work of going through
the stylesheet and inserting a namespace prefix [or switching
to local-name() and namespace-uri()] wherever
(and only where) an element name is given in an XPath
expression or a pattern.
I.e. when the stylesheet already exists and does not use
a namespace for the source document.

Lars


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.