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

Re: Aargh - wrong template applied

Subject: Re: Aargh - wrong template applied
From: "andrew welch" <andrew.j.welch@xxxxxxxxx>
Date: Thu, 20 Apr 2006 09:36:30 +0100
Re:  Aargh - wrong template applied
> > The fact that it's the same namespace as everything else is
> > irrelevant. If
> > it's in a namespace, then references to it in the stylesheet need
> > to be
> > prefixed.
> >
> > See http://www.dpawson.co.uk/xsl/sect2/N5536.html #13 and #23
>
> Ok, I get it. Binding the XHTML namespace to the html prefix lets me
> match with html:font. The document I'm processing now has the XHTML
> namespace as the default, whereas the other documents I've been
> working with had no namespace.
>
> It really [expletive deleted] that I can't assign a default namespace in my
> stylesheet.


If you have to match elements in both a namespace and no namespace,
then just have:

match="html:font|font"

where html is the prefix of the namespace, and "font" is the match for
the element in no namespace.  I don't think you would want to assign a
default namespace in the stylesheet... unless of course you have lots
of match patterns and don't want to change each one...... in which
case do a two step transform to remove any namespaces, eg:

<xsl:variable name="firstPass">
  <xsl:apply-templates mode="removeNamespaces"/>
...

<xsl:template match="*" mode="removeNamespaces">
  <xsl:element name="{local-name()}">
    <xsl:copy-of select="@*"/>
      <xsl:apply-templates mode="removeNamespaces"/>
....

Then apply your usual transform on $firstPass.

cheers
andrew

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.