[xsl] Unwanted (default) namespaces.

Subject: [xsl] Unwanted (default) namespaces.
From: "Edward L. Knoll" <ed.knoll@xxxxxxxxxxxxxx>
Date: Mon, 08 Jul 2002 12:19:39 -0600
   I have an XML file which I process with an XSL stylesheet to
   create another XSL stylesheet included by other XSL
   stylesheets.   This was working until I decided to change our
   XML files to be within a namespace to avoid possible future
   maintenance/integration issues.   When I made this change, a
   namespace started showing up on an HTML tag which was being
   copied from the XML file to the generated XSL file: <html:br\>
   became <html:br xmlns="http://fedex.com/gnsl"/>.

   Outside of eliminating my use of the default namespace in my
   source XML file, I have discovered no way to circumvent the
   inclusion of this unwanted "xmlns" attribute.  I am using the
   XalanC++ 'Xalan'  and 'testXSLT' XSL processors.

   The source XML file has the following (truncated) content:
   <TagLabels  xmlns:html="http://www.w3.org/1999/xhtml";
               xmlns="http://fedex.com/gnsl"; >
   <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="http://www.w3.org/1999/XSL/Transform";
                    xmlns:html="http://www.w3.org/1999/xhtml";
                    xmlns:gnsl="http://fedex.com/gnsl";
                    exclude-result-prefixes="gnsl html" >

   <!--stuff excluded-->

   <xsl:template match="/gnsl:TagLabels" mode="BuildVariables" >
      <xsl:apply-templates select="gnsl:Tag"
   mode="BuildVariables">
         <xsl:sort select="@name" />
      </xsl:apply-templates>
   </xsl:template>

   <xsl:template match="gnsl:Tag" mode="BuildVariables" >
      <xsl:element name="xsl:variable">
         <xsl:attribute name="name">
            <xsl:value-of select="@name" />
         </xsl:attribute>
         <xsl:copy-of select="*|@*|text()" />
      </xsl:element>
      <xsl:copy-of select="$LineBreak" />
   </xsl:template>

   <!--stuff excluded-->

   </xsl:stylesheet>

Thanks for any assistenace which can be provided.

Regards,
Ed Knoll

--
Edward L. Knoll   Phone (work)     : (719)484-2717
                  e-mail (work)    : f49660c@xxxxxxxxxxxxxx
                  e-mail (business): eknoll@xxxxxxxxxx
                  e-mail (personal): edward@xxxxxxxxxxx












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


Current Thread