Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> XML Transformation: Insert schema reference in output doc ( Beginners question )

XML Transformation: Insert schema reference in output doc ( Beginners question )

From: Willy <wilhelmkanzler_at_t-online.de>
Date: 14 Feb 2006 02:37:07 -0800
Message-ID: <1139913427.883891.226150@g14g2000cwa.googlegroups.com>


Hello,

I have a Stylesheet which works fine except for inserting a reference to a schema file in my output file.

The schema file is located on
http://www.agrolab.de/sikb/xsd-labresultaatgegevens_SIKB_0101_versie_3.6.0.xsd" I don't have any namespace defined myself

I want my output doc to look like this
<?xml version="1.0" encoding="UTF-8"?>
<labresultaat

           xsi:schemaLocation="http://www.element-examples.org http://www.agrolab.de/sikb/xsd-labresultaatgegevens_SIKB_0101_versie_3.6.0.xsd"

              xmlns="http://www.element-examples.org"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <projectgegevens>
     ........

This is my Stylesheet ( the last of many different tries ):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml"/>
<xsl:template match="XML_REPORT">
<labresultaat

        xmlns="http://www.element-examples.org"
        xsi:schemaLocation="http://www.element-examples.org
http://www.agrolab.de/sikb/xsd-labresultaatgegevens_SIKB_0101_versie_3.6.0.xsd"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<xsl:apply-templates/>
</labresultaat>
</xsl:template>
<xsl:template match="KUNDE">
<projectgegevens>

......
XMLSpy does not accept this as valid XML-File because it wants to validate now the XSL against the Schema.

If I transform my XML using the above Stylesheet I get output doc as follows:
<?xml version="1.0" encoding="UTF-8"?>
<labresultaat xsi:schemaLocation="http://www.element-examples.org
http://www.agrolab.de/sikb/xsd-labresultaatgegevens_SIKB_0101_versie_3.6.0.xsd" xmlns="http://www.element-examples.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">   <projectgegevens xmlns="">
......

which is not valid because of the xmlns="" within <projectgegevens xmlns="">
Removing manually xmlns="" makes the outputfile valid.

How can I insert the schema reference in <labresultaat> without destroying my <projectgegevens>-Tag ?

Thank you in advance for your help
Willy Received on Tue Feb 14 2006 - 04:37:07 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US