Subject: Re: [xsl] Unwanted (default) namespaces. From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 08 Jul 2002 16:29:22 -0400 |
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" >
T:\ftemp>type knoll.xsl <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet 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" version="1.0">
<xsl:template match="html:*"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template>
T:\ftemp>type knoll2.xsl <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet 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" version="1.0">
<xsl:template match="html:*"> <xsl:element name="{local-name()}"> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:element> </xsl:template>
T:\ftemp>xt knoll.xml knoll.xsl <?xml version="1.0" encoding="utf-8"?>
T:\ftemp>xt knoll.xml knoll2.xsl <?xml version="1.0" encoding="utf-8"?>
-- Upcoming: 3-days XSLT/XPath and/or 2-days XSL-FO:Sep 30-Oct 4,2002
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) ISBN 0-13-065196-6 Definitive XSLT and XPath ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-07-1 Practical Formatting Using XSLFO XSL/XML/DSSSL/SGML/OmniMark services, books (electronic, printed), articles, training (instructor-live,Internet-live,web/CD,licensed) Next public training: 2002-08-05,26,27,09-30,10-03
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Unwanted (default) namespaces, Edward L. Knoll | Thread | Re: [xsl] Unwanted (default) namesp, Jeni Tennison |
Re: [xsl] Want to process XHTML in , Jeni Tennison | Date | Re: [xsl] Unwanted (default) namesp, Jeni Tennison |
Month |