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
krishna marupeddiSubject: Remove namespace prefix and rename an element (which is also a group node)
Author: krishna marupeddi
Date: 28 Feb 2006 03:13 AM
Originally Posted: 28 Feb 2006 03:07 AM
Hi, I am trying to remove all the namespace prefix from the attached document and rename one element as it exists as a group node too. We did find a way to get rid of namespace prefix, but renaming is a problem to incorporate it in the same transformation.<br> <br> The element that needs to be renamed is "ShipmentStatus" in the "ShipmentStatusEvent" group. I am unable to refer it using the following code in the attached xsl. <xsl:template match="./ShipmentStatus/ShipmentInformation/RoutingInformation/ShipmentStatusEvent/ShipmentStatus"> <ShipmentStatusCode> <xsl:apply-templates select="ShipmentStatus"/> </ShipmentStatusCode> </xsl:template> <xsl:template match="ShipmentStatus"> <xsl:value-of select="name()"/> <xsl:value-of select="@id"/> </xsl:template> If I run the above transformation after the namespace prefixes are removed, it works fine. Is there a way we can club both the requirements in one transformation ? Attached is the document and the xsl. Appreciate any help in this regard.<br> <br> Thanks<br> Krishna


DocumentStripNS.xsl


UnknownShipmentStatusDistribution.xml

Postnext
Minollo I.Subject: Remove namespace prefix and rename an element (which is also a group node)
Author: Minollo I.
Date: 28 Feb 2006 12:56 PM
If I well understand, probably you need to add something like this:

<xsl:template match="iss:ShipmentStatus" xmlns:iss="urn:rosettanet:specification:interchange:ShipmentStatus:xsd:codelist:01.01">
<ShipmentStatusCode>
<xsl:value-of select="."/>
</ShipmentStatusCode>
</xsl:template>

Minollo

Postnext
krishna marupeddiSubject: Remove namespace prefix and rename an element (which is also a group node)
Author: krishna marupeddi
Date: 28 Feb 2006 02:45 PM
Originally Posted: 28 Feb 2006 02:43 PM
Hi Minollo,<br> This solves part of the above issue. The intent of the whole transformation was to remove the namespaces and any prefixes the nodes have. With the option that was provided by you, I could not remove the namespace. Is there a way to remove the namespace on the new element "ShipmentStatusCode" ? With the above modification that you mentioned, it is creating the element like "<ShipmentStatusCode xmlns:iss="urn:rosettanet:specification:interchange:ShipmentStatus:xsd:codelist:01.01">AAA</ShipmentStatusCode>"<br> <br> Thanks in advance.<br> <br> Regards,<br> Krishna

Posttop
Minollo I.Subject: Remove namespace prefix and rename an element (which is also a group node)
Author: Minollo I.
Date: 28 Feb 2006 03:08 PM
You need to tell the stylesheet to exlude iss from the result:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:iss="urn:rosettanet:specification:interchange:ShipmentStatus:xsd:codelist:01.01"
exclude-result-prefixes="iss">
...

 
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.