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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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">
...

   
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.