Subject: [xsl] adding namespaces to result nodes From: omprakash.v@xxxxxxxxxxxxx Date: Fri, 8 Apr 2005 13:16:14 +0530 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] for-each-loop case, Michael Kay | Thread | RE: [xsl] adding namespaces to resu, Michael Kay |
RE: [xsl] for-each-loop case, Michael Kay | Date | Re: [xsl] Test For Numeric Values?, James Fuller |
Month |