This is the mail archive of the mailing list .

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unwanted (default) namespaces.

> > I have an XML file which I process with an XSL stylesheet to create


> >    The source XML file has the following (truncated) content:
> >    <TagLabels  xmlns:html="";
> >                xmlns=""; >
> >    <Tag name="GNSL_LOCATION_TYPE_CD">LOC<html:br/>TYPE</Tag>
> >    </TagLabels>
> >
> > The XSL stylesheet declaration and the templates which output the
> > offending statement follow:
> >
> >    <xsl:stylesheet version="1.0"
> >    xmlns:xsl="";
> >                     xmlns:html="";
> >                     xmlns:gnsl="";
> >                     exclude-result-prefixes="gnsl html" >
> [snip]
> OK, the namespace node that's creating the namespace declaration that
> you're seeing is the one in the source document. Your html:br element
> in the source document has a namespace node associated the default
> namespace with the namespace ''. My guess is that
> you're copying the html:br element in your document, with something
> like:
> <xsl:template match="html:*">
>   <xsl:copy>
>     <xsl:apply-templates select="@*|node()" />
>   </xsl:copy>
> </xsl:template>
> When you copy an element, with xsl:copy or xsl:copy-of, you copy all
> its namespace nodes as well. So rather than doing that, you need to
> create an element without any associated namespace nodes, which means
> that you have to use xsl:element. Try using:
> <xsl:template match="html:*">
>   <xsl:element name="html:{local-name()}">
>     <xsl:apply-templates select="@*|node()" />
>   </xsl:element>
> </xsl:template>

You're right; that's how I was propogating the <html:br/> tag forward.  I
have to confess that namespaces are the one area of XSL (I'm currently
aware of) that I really don't have a handle on, so if you don't mind, I'd
like to "kick the dead horse" a bit.

In the source XML document, the <html:br/> tag is completely qualified.
Why is the choice being made to associate an additional (the default)
namespace with this node?  This seems like it will cause problems in
environments in which components from multiple namespaces are being
integrated.   Does this mean we shouldn't define default namespaces in
situations involving multiple namespaces?  I don't understand why that
node is being associated with a namespace other than what it was
explicitly referenced by.   Could you describe what aspect/rule
associated with the XSL transformation causes this additional namespace
to be associated with that node?


 XSL-List info and archive:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]