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

RE: strip-spaces

Subject: RE: strip-spaces
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 5 Feb 2008 18:05:16 -0000
RE:  strip-spaces
> Having done that I note that an xmlns tag is now on some 
> nodes and not on others.
> 
> 	1. why has the serializer placed these tags on any node 
> (for example, some <p> node and not others)?

The serializer will add an xmlns="" namespace declaration to any element if
(a) that element has a name in no namespace, and (b) its parent has a name
that is in a specific namespace.

> 	2. how can I get rid of them (globally specify the 
> namespace) because these tags significantly increase the file size?

File size is immaterial. You need to get rid of them because your elements
have the wrong names, which is much more important. The way you get rid of
them is to generate elements that have the right names in the first place,
always remembering that an element name is in two parts: the local part and
the namespace URI.
> 
> I assume the fact that the serializer has been selective 
> tells me something about the way I've written the template - 
> what have I done wrong?

I haven't followed this thread closely, I thought a lot of people had been
telling you what you did wrong. The most common reason is doing something
like

<xsl:template match="parent">
  <div xmlns="namespace1">
    <xsl:apply-templates select="child"/>
  </div>
</xsl:template>

<xsl:template match="parent">
  <p>
    <xsl:apply-templates select="child"/>
  </p>
</xsl:template>

and the fix is to generate the <p> element in the same namespace as its
parent, which can be achieved using

<p xmlns="namespace1">

Michael Kay
http://www.saxonica.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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-2007 All Rights Reserved.