This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

xml to xml with a xmlns schema 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]