[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

adding namespaces to result nodes

Subject: adding namespaces to result nodes
From: omprakash.v@xxxxxxxxxxxxx
Date: Fri, 8 Apr 2005 13:16:14 +0530
recipe.xsd
Hi,

        Iam using <xsl:for-each select="namespace:*"> to iterate over all
namespace attributes on the input element and write them to the result.
using <xsl:value-of select=name(.)"/> and <xsl:value-of select=."/>.


Now when I do an inverse transform in an effort to recreate the original
xml, my xml comes out like this. I still haven't managed to get the schema
namespace in my result probably because the xmlns:xsl is treated as a
namespace and xsi:schemaLocation as an attribute.

<?xml version="1.0" encoding="UTF-8"?>
<ns0:slideshow xmlns:ns0="urn:hl7-org/v3" a_title="Sample Slide Show"
author="Yours Truly" date="Date of publication"/>
<ns1:slide xmlns:ns1="urn:hl7-org/v3"/>
<title/>
<ns2:slide xmlns:ns2="urn:hl7-org/v3"/>
<title/>
<item/>

My original xml I started out with looked as follows:

<?xml version='1.0' encoding='utf-8'?>

<slideshow xmlns="urn:hl7-org/v3" xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://tiling.org/xmlcatalogs/namespaces/recipe
    http://tiling.org/xmlcatalogs/schemas/recipe.xsd" a_title="Sample Slide
Show"
    date="Date of publication"
    author="Yours Truly">

    <slide type="all">
      <title>Wake up to WonderWidgets!</title>
    </slide>

Iam using DC's suggestion to create elements in the right namespace as
follows:

<xsl:element name="{$elemname}" namespace="{$nsname}">


As you can see the inverse transformed output has prefixes where my
original had none. Also, the prefixes are numbered like ns0, ns1 etc. which
I don't think is not correct. Ideally, I would like for my result to look
exactly or as close to the original as possible. Could someone explain how
to attach multiple namespace nodes like xmlns, xmlns:xsi etc to my element.


Cheers,
Omprakash.V


This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.