W
william_hulse
The general process i am currently working on is this:
STEP 1 xml doc1 is transformed using stylesheet1 to produce xml doc2
- xml doc1 has a namespace declaration as follows...
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<?xml-stylesheet type="text/xsl"
href="G:\Working\User\Will_Hulse\NEW\xmldb\code\Bank_Statements_Schema\EXBAEUFRED01.xsl"?>
<FILE>
<GENERAL>
......
</FILE>
- stylesheet1 has namespace declaration as follows
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xslutput indent="yes"/>
....
</xsl:stylesheet>
- the result has namespace as follows
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl"
href="G:\Working\User\Will_Hulse\NEW\xmldb\code\Bank_Statements_Schema\EXBAEUFRED02.xsl"?>
<FILE>
<GENERAL>
....
</file>
.... which is fine
STEP 2 - xml doc2 is transformed using stylesheet2 to produce xml doc3
which must conform to an xml schema
- xml doc2 has namespace as follows
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl"
href="G:\Working\User\Will_Hulse\NEW\xmldb\code\Bank_Statements_Schema\EXBAEUFRED02.xsl"?>
<FILE>
<GENERAL>
....
</file>
- stylesheet2 has namespace declaration as follows
?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xslutput method="xml" omit-xml-declaration="no" indent="yes"/>
- but also has the following clause to insert namespace info into
resulting document, 'linking' it to a schema bank_stat.xsd
<FILE xmlns="http://www.oracle.com/bank_stat.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.oracle.com/bank_stat.xsd
G:\Working\User\Will_Hulse\NEW\xmldb\code\Bank_Statements_Schema\BANK_STAT.xsd">
<xsl:apply-templates select="BANK_STATEMENTS"/>
</FILE>
The result however contains the following with a bogus empty namespace
declaration in BANK_STATEMENTS
<?xml version="1.0" encoding="UTF-8"?>
<FILE xmlns="http://www.oracle.com/bank_stat.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.oracle.com/bank_stat.xsd
G:\Working\User\Will_Hulse\NEW\xmldb\code\Bank_Statements_Schema\BANK_STAT.xsd">
<BANK_STATEMENTS xmlns="">
<GENERAL>
<FILENAME>EUBAEUFRED01.XML</FILENAME>
.....
-- the namespace of the schema is as follows
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.oracle.com/bank_stat.xsd"
xmlns:xdb="http://xmlns.oracle.com/xdb"
targetNamespace="http://www.oracle.com/bank_stat.xsd"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="FILE">
<xs:complexType>
Questions..
- Why does the bank statements tag contain xmlns="" and how can we stop
it happening?
- Is there a better way to insert schema referencing into the result of
an xsl transform?
- How does the schema namespace attributes elementFormDefault and
attributeFormDefault play a part in this...
making the value of elementFormDefault = "unqualified" in the schema
makes the xml fail validation. If we
then remove the bogus xmlns="" from the doc, it then passes
validation..
Any help with the above would be greatly appreciated...
Regards
Will
STEP 1 xml doc1 is transformed using stylesheet1 to produce xml doc2
- xml doc1 has a namespace declaration as follows...
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<?xml-stylesheet type="text/xsl"
href="G:\Working\User\Will_Hulse\NEW\xmldb\code\Bank_Statements_Schema\EXBAEUFRED01.xsl"?>
<FILE>
<GENERAL>
......
</FILE>
- stylesheet1 has namespace declaration as follows
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xslutput indent="yes"/>
....
</xsl:stylesheet>
- the result has namespace as follows
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl"
href="G:\Working\User\Will_Hulse\NEW\xmldb\code\Bank_Statements_Schema\EXBAEUFRED02.xsl"?>
<FILE>
<GENERAL>
....
</file>
.... which is fine
STEP 2 - xml doc2 is transformed using stylesheet2 to produce xml doc3
which must conform to an xml schema
- xml doc2 has namespace as follows
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl"
href="G:\Working\User\Will_Hulse\NEW\xmldb\code\Bank_Statements_Schema\EXBAEUFRED02.xsl"?>
<FILE>
<GENERAL>
....
</file>
- stylesheet2 has namespace declaration as follows
?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xslutput method="xml" omit-xml-declaration="no" indent="yes"/>
- but also has the following clause to insert namespace info into
resulting document, 'linking' it to a schema bank_stat.xsd
<FILE xmlns="http://www.oracle.com/bank_stat.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.oracle.com/bank_stat.xsd
G:\Working\User\Will_Hulse\NEW\xmldb\code\Bank_Statements_Schema\BANK_STAT.xsd">
<xsl:apply-templates select="BANK_STATEMENTS"/>
</FILE>
The result however contains the following with a bogus empty namespace
declaration in BANK_STATEMENTS
<?xml version="1.0" encoding="UTF-8"?>
<FILE xmlns="http://www.oracle.com/bank_stat.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.oracle.com/bank_stat.xsd
G:\Working\User\Will_Hulse\NEW\xmldb\code\Bank_Statements_Schema\BANK_STAT.xsd">
<BANK_STATEMENTS xmlns="">
<GENERAL>
<FILENAME>EUBAEUFRED01.XML</FILENAME>
.....
-- the namespace of the schema is as follows
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.oracle.com/bank_stat.xsd"
xmlns:xdb="http://xmlns.oracle.com/xdb"
targetNamespace="http://www.oracle.com/bank_stat.xsd"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="FILE">
<xs:complexType>
Questions..
- Why does the bank statements tag contain xmlns="" and how can we stop
it happening?
- Is there a better way to insert schema referencing into the result of
an xsl transform?
- How does the schema namespace attributes elementFormDefault and
attributeFormDefault play a part in this...
making the value of elementFormDefault = "unqualified" in the schema
makes the xml fail validation. If we
then remove the bogus xmlns="" from the doc, it then passes
validation..
Any help with the above would be greatly appreciated...
Regards
Will