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:\Workin g\User\Will_Hul se\NEW\xmldb\co de\Bank_Stateme nts_Schema\EXBA EUFRED01.xsl"?>
<FILE>
<GENERAL>
......
</FILE>
- stylesheet1 has namespace declaration as follows
<?xml version="1.0"?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes"/>
....
</xsl:stylesheet>
- the result has namespace as follows
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl"
href="G:\Workin g\User\Will_Hul se\NEW\xmldb\co de\Bank_Stateme nts_Schema\EXBA EUFRED02.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:\Workin g\User\Will_Hul se\NEW\xmldb\co de\Bank_Stateme nts_Schema\EXBA EUFRED02.xsl"?>
<FILE>
<GENERAL>
....
</file>
- stylesheet2 has namespace declaration as follows
?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output 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:schemaLocat ion="http://www.oracle.com/bank_stat.xsd
G:\Working\User \Will_Hulse\NEW \xmldb\code\Ban k_Statements_Sc hema\BANK_STAT. xsd">
<xsl:apply-templates select="BANK_ST ATEMENTS"/>
</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:schemaLocat ion="http://www.oracle.com/bank_stat.xsd
G:\Working\User \Will_Hulse\NEW \xmldb\code\Ban k_Statements_Sc hema\BANK_STAT. xsd">
<BANK_STATEMENT S xmlns="">
<GENERAL>
<FILENAME>EUBAE UFRED01.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.co m/xdb"
targetNamespace ="http://www.oracle.com/bank_stat.xsd"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<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 elementFormDefa ult and
attributeFormDe fault play a part in this...
making the value of elementFormDefa ult = "unqualifie d" 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:\Workin g\User\Will_Hul se\NEW\xmldb\co de\Bank_Stateme nts_Schema\EXBA EUFRED01.xsl"?>
<FILE>
<GENERAL>
......
</FILE>
- stylesheet1 has namespace declaration as follows
<?xml version="1.0"?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes"/>
....
</xsl:stylesheet>
- the result has namespace as follows
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl"
href="G:\Workin g\User\Will_Hul se\NEW\xmldb\co de\Bank_Stateme nts_Schema\EXBA EUFRED02.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:\Workin g\User\Will_Hul se\NEW\xmldb\co de\Bank_Stateme nts_Schema\EXBA EUFRED02.xsl"?>
<FILE>
<GENERAL>
....
</file>
- stylesheet2 has namespace declaration as follows
?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output 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:schemaLocat ion="http://www.oracle.com/bank_stat.xsd
G:\Working\User \Will_Hulse\NEW \xmldb\code\Ban k_Statements_Sc hema\BANK_STAT. xsd">
<xsl:apply-templates select="BANK_ST ATEMENTS"/>
</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:schemaLocat ion="http://www.oracle.com/bank_stat.xsd
G:\Working\User \Will_Hulse\NEW \xmldb\code\Ban k_Statements_Sc hema\BANK_STAT. xsd">
<BANK_STATEMENT S xmlns="">
<GENERAL>
<FILENAME>EUBAE UFRED01.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.co m/xdb"
targetNamespace ="http://www.oracle.com/bank_stat.xsd"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<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 elementFormDefa ult and
attributeFormDe fault play a part in this...
making the value of elementFormDefa ult = "unqualifie d" 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
Comment