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

xml to xml with a xmlns schema reference

Subject: xml to xml with a xmlns schema reference
From: "Ian Hord" <ian@xxxxxxxx>
Date: Sat, 4 May 2002 19:10:45 +1000
xmlns reference
Hi all,

I am pretty new to xslt and trying to produce xml from another xml. I am
putting a reference in to the new xml file root element for a schema, which
works, but get an empty namespace reference in the child element.

I am using xmlspy with internet explorer 6.0.26 for transformations.

What is going wrong any suggestions?

Thanks in advance,

Ian.

The xml is..

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- edited with XML Spy v3.0.7 (http://www.xmlspy.com) by ianhord
(private) -->
<!DOCTYPE cabinet SYSTEM "C:\My
Documents\projectdevelopment\xmldocs\cabinet.dtd">
<?xml-stylesheet type="text/xsl" href="C:\My
Documents\projectdevelopment\xmldocs\cabnettoloclist2.xsl"?>
<cabinet>
	<report>
		<reportid>001</reportid>
		<datestart>
			<day>1</day>
			<month>February</month>
			<year>1990</year>
		</datestart>
		<datefinish>
			<day>1</day>
			<month>2</month>
			<year>98</year>
		</datefinish>
	<report>
<cabinet>

the stylesheet is ..

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" indent="yes"/>

<xsl:template match="/cabinet">
	<xsl:element name="XML_DATA_ISLAND_LOCATION"
namespace="x-schema:DD_16394.xml">		<xsl:apply-templates select="report"/>
	</xsl:element>
</xsl:template>
<xsl:template match="report">
	<xsl:element name="report">
		<xsl:element name="finishday">
			<xsl:value-of select="datefinish/day"/>
		</xsl:element>
		<xsl:element name="finishmonth">
			<xsl:value-of select="datefinish/month"/>
		</xsl:element>
		<xsl:element name="finishyear">
			<xsl:value-of select="datefinish/year"/>
		</xsl:element>
	</xsl:element>
</xsl:template>
</xsl:stylesheet>

The output is..

<?xml version="1.0" encoding="UTF-16"?>
<XML_DATA_ISLAND_LOCATION xmlns="x-schema:DD_16394.xml">
<report xmlns="">
<finishday>1</finishday>
<finishmonth>2</finishmonth>
<finishyear>98</finishyear>
</report>
</XML_DATA_ISLAND_LOCATION>

the output I want is...

<?xml version="1.0" encoding="UTF-16"?>
<XML_DATA_ISLAND_LOCATION xmlns="x-schema:DD_16394.xml">
<report>
<finishday>1</finishday>
<finishmonth>2</finishmonth>
<finishyear>98</finishyear>
</report>
</XML_DATA_ISLAND_LOCATION>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.