Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 13th, 2009, 12:59 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default Stop namespace node from appearing

I have this example XSL

Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msn="http://foo.org"
      exclude-result-prefixes="xs"
      version="2.0">
    <xsl:output method="xml" indent="yes"></xsl:output>
    <xsl:template match="root">
        <msn:sub>
            <xsl:apply-templates></xsl:apply-templates>
        </msn:sub>
    </xsl:template>    
</xsl:stylesheet>
my output has

<msn:sub xmlns:msn="http://foo.org">

I want it to be <msn:sub> only

How can I do that?
 
Old March 13th, 2009, 04:08 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

XSLT output will always be namespace-well-formed. If an element in the result tree uses the msn: prefix, then the result tree will contain a declaration of that prefix. There is no way of switching this off, any more than you could generate an end tag that doesn't match the corresponding start tag.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Namespace, node() and local-name() akentanaka XSLT 3 June 27th, 2008 04:19 AM
Stop button won't stop loop JDShaffer Visual Basic 2008 Essentials 3 May 23rd, 2008 03:22 PM
Get Node Name without namespace ramesh.kumarm XSLT 1 September 29th, 2006 02:07 AM
Access Namespace Node using XPath pvasudevan XSLT 1 January 2nd, 2006 06:20 AM
Copying Source Node attributes to output node pvsat XSLT 2 November 3rd, 2005 09:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.