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 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Francisco MonteiroSubject: Add a namespace to all elements
Author: Francisco Monteiro
Date: 20 Sep 2004 02:51 AM
I am using an external s/w which requires that schemas do not use external namespace.
How would I go about easily adding a namespace prefix to all elements?

Attached is an example schema which needs reworking

Kind Regards
Francisco


DocumentMovementsAnalysis.xsd
The schema in question

Postnext
Ivan PedruzziSubject: Add a namespace to all elements
Author: Ivan Pedruzzi
Date: 23 Sep 2004 09:11 PM
Hi Francisco,

Could you provide an example of expected result?

Is your goal migrate all elements from one namespace to another
like that?

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:myns="myns">
<xsl:output method="xml" indent="yes"/>

<xsl:template match="*">
<xsl:element name="{concat('myns:',local-name())}" namespace="myns">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>

<xsl:template match="@*">
<xsl:attribute name="{concat('myns:',local-name())}" namespace="myns">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>

</xsl:stylesheet>

Posttop
Francisco MonteiroSubject: Add a namespace to all elements
Author: Francisco Monteiro
Date: 24 Sep 2004 01:48 AM
Thanks this is exactly what I needed.
Francisco

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 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.