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 June 16th, 2006, 01:09 AM
Authorized User
 
Join Date: Jun 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ignoring namespace in source XML

Just wondering, if it is possible for a stylesheet to ignore the namespace provided in the source XML and just perform the translation.

An example of my source XML is

<RootNode xmlns="http://xmlns.myWork.com.au/V3">
    <BatchHeader ProductionData="Yes" TrainingMode="No">
        <ElementNode>JustTesting</ElementNode>
        <Identifier UniqueID="CBABatch-1122453"/>
    </BatchHeader>
</RootNode>

To illustrate a simple example, I want my stylesheet to process the above source XML and generate the following outcome

<RootNode>
    <BatchHeader ProductionData="Yes" TrainingMode="No">
        <ElementNode>JustTesting</ElementNode>
        <Identifier UniqueID="CBABatch-1122453"/>
    </BatchHeader>
</RootNode>

thanks

 
Old June 16th, 2006, 03:29 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You can achieve this with a variant of the identity transform:

<xsl:template match="*">
  <xsl:element name="{local-name()}">
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </
</

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Transforming XML From One Namespace to Another mail4kaja XSLT 1 November 10th, 2008 10:14 AM
convert XML to XMl - Another Namespace question bonekrusher XSLT 2 July 10th, 2007 07:32 AM
Converting Source Xml into Target Xml Using XSL. alapati.sasi XSLT 3 May 14th, 2007 10:54 AM
Ignoring Namespace Pt2 Chamkaur XSLT 1 June 19th, 2006 05:08 AM
xml namespace and asp werD420 XML 1 August 12th, 2005 01:12 PM





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