XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
James HughesSubject: XSLT Transformation w/ namespaces
Author: James Hughes
Date: 06 Feb 2008 11:17 AM
I am trying to get a XSLT that will transform both of the following cases:

Case 1

Input Xml
<a xmlns="tempURI.org"><b xmlns="abc.org">1<b></a>

Output Xml
<a xmlns="newURI.org"><b xmlns="abc.org">1<b></a>

and

Case 2

Input Xml
<tmp:a xmlns:tmp="tempURI.org"><b xmlns="abc.org">1<b></tmp:a>

Output Xml
<a xmlns="newURI.org"><b xmlns="abc.org">1<b></a>

Note: The child elements of the root element could be any number of elements in any namespace. If the elements are in the target's default namespace, the elements should not have a prefix.

Any help would be greatly appreciated,

James

Postnext
James DurningSubject: XSLT Transformation w/ namespaces
Author: James Durning
Date: 06 Feb 2008 12:00 PM
In your stylesheet node:
xmlns:tm="tempURI.org"

<xsl:template match="tm:a">
<a xmlns="newURI.org">
<xsl:copy-of select="*"/>
</a>
</xsl:template>

Posttop
James HughesSubject: XSLT Transformation w/ namespaces
Author: James Hughes
Date: 06 Feb 2008 12:12 PM
How would you handle the issue of the child elements of the root element that are in the tempURI.org namespace but in the target they should be in the newURI.org namespace like the root element?

Example

Case 1

Input Xml
<a xmlns="tempURI.org"><b xmlns="abc.org">1<b><c>2</c></a>

Output Xml
<a xmlns="newURI.org"><b xmlns="abc.org">1<b><c>2</c></a>

and

Case 2

Input Xml
<tmp:a xmlns:tmp="tempURI.org"><b xmlns="abc.org">1<b><tmp:c>2</tmp:c></tmp:a>

Output Xml
<a xmlns="newURI.org"><b xmlns="abc.org">1<b><c>2</c></a>

Thanks for your time with this!

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.