[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Unwanted (default) namespaces.
At 2002-07-08 12:19 -0600, Edward L. Knoll wrote:
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"/>. Note that exclude-result-prefixes= only prunes namespace nodes from the stylesheet tree and never from the source tree. Elements copied from the source tree will always copy ancestral namespace nodes from the source tree to the result tree. I'm assuming in your "stuff excluded" section you are copying the HTML <br/> from the source tree to the result tree, thus copying the ancestral namespace. I'm also assuming that you never want any of your GNSL namespace nodes in your HTML, so therefore you must not be doing any copying of those nodes to the result tree. Therefore, your solution would be to create a template for all of the nodes in the HTML namespace and re-synthesize the HTML elements in the result tree instead of copying them, so you would have something along the lines of the following. Note how using knoll.xsl the namespaces are copied as you report your problem, but with knoll2.xsl the namespaces do not show up. I added an attribute to an HTML element in your data to show that attribute nodes can be copied. I hope this helps. ................. Ken p.s. some of the HTML markup in the following example may get eaten by your mailer if it interprets HTML ... looking at the following as simple text illustrates the point I am trying to make. T:\ftemp>type knoll.xml <?xml version="1.0" encoding="iso-8859-1"?> <TagLabels xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://fedex.com/gnsl" > <Tag name="GNSL_LOCATION_TYPE_CD">LOC<html:br/>TYPE<html:a href="abc"/>END</Tag> </TagLabels> 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> </xsl:stylesheet> 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> </xsl:stylesheet> T:\ftemp>xt knoll.xml knoll.xsl <?xml version="1.0" encoding="utf-8"?> LOC<html:br xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://fedex.com/gnsl"/>TYPE<html:a href="test" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://fedex.com/gnsl"/>END T:\ftemp>xt knoll.xml knoll2.xsl <?xml version="1.0" encoding="utf-8"?> LOC<br/>TYPE<a href="test"/>END T:\ftemp>
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 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|