![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: How to add namespace attribute to transformed xml? How to add namespace attribute to transformed xml?To: NULL Date: 8/15/2006 9:09:00 AM
Hi,
I´ve got the following problem and need help for it.
Given the following source xml file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Table xmlns="x-schema:Account_Schema.xml">
<Account>0815</Account>
</Table>
What I want is to transform this into the following:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Table xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opendata.de/COMPASS/Account
Account.xsd">
<Account>0815</Account>
</Table>
So I tried this XSL:
<?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" version="1.0" encoding="ISO-8859-1" indent="yes"
/>
<xsl:template match="/Table">
<xsl:element name="Table">
<xsl:attribute name="xmlns:xsi">
<xsl:value-of select="http://www.w3.org/2001/XMLSchema-instance"
/>
</xsl:attribute>
<xsl:attribute name="xsi:schemaLocation">
<xsl:value-of select="http://www.opendata.de/COMPASS/Account
Account.xsd" />
</xsl:attribute>
<xsl:element name="Account">
<xsl:value-of select="Account" />
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
The transformation is done by some VB6-code, mainly by invoking the method
"transformNode" on a instance variable of the type "MSXML2.DOMDocument40".
What I get is an error message like this: "The value of the 'name' attribute
may not be 'xmlns:xsi'."
If I comment out the two <xsl:attribute> elements I receive the following:
<?xml version="1.0"?>0815
I haven´t any idea how to solve the problem. So I highly appreciate any
help. Thank you in advance!
Kind regards,
Marcus
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
