Oracle XSLT: Standard-Namespace führt zu leeren Tags
Ich denke, der beste Weg, diese Frage zu stellen, ist: Wie gebe ich einen Standard-Namespace für das Root-Element in der Ausgabe an? Dies tun
<xsl:template match="/">
<r xmlns:s"http://www.mycompany.com/s/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.mycompany.com/default/schema" >
....
....
Gibt mir einen Fehler in Oracle:
ORA-31011: XML Parsing Failed ORA-19201: Error occurred in in XML Processing LPX-00604: Invalid attribute 'nIfNotExist', for attribute 'name' ORA-06512: at SYS.XMLType at line 74 ORA-06512: at line 24
bei dem die'nIfNotExist'
ist eine Vorlage:
<xsl:template name="nIfNotExist" xmlns:scom="http://www.mycomapny.com/s/schema">
<xsl:param name="nodeToTest"/>
<xsl:param name="nodeName"/>
...
Ich möchte, dass das Wurzelelement des resultierenden Dokuments so aussieht:
<r xmlns:s="http://www.mycompany.com/s/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.mycompany.com/default/schema">
Ich möchte"http://www.mycompany.com/default/schema"
als Standard-Namespace, damit das Dokument die XSD-Validierung bestehen kann. Andernfalls muss ich es manuell hinzufügen, bevor die Validierung ausgeführt wird (keine Option für die Stapelverarbeitung).
BEARBEITE
Ich habe es versucht:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:s="http://www.mycompany.com/schema"
xmlns="http://www.mycompany.com/def_schema">
Das Ergebnis ist ein Dokument ohne Daten, wie folgt:
<r xmlns:s="http://www.mycompany.com/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.mycompany.com/def_schema">
<a></a>
<s:b></s:b>
<c></c>
....
Es hätte sein sollen
<r xmlns:s="http://www.mycompany.com/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.mycompany.com/def_schema">
<a>123</a>
<s:b>ABC34L</s:b>
<c>7.092381</c>
AKTUALISIERE
Quellendaten sehen ungefähr so aus (für die eingegebenen Daten sind keine Namespaces definiert):
<ROOT_NODE>
<DATA_A>1234</DATA_A>
<DATA_B>34567</DATA_B>
<OTHER_DATA_C>7.123456</OTHER_DATA_C>
</ROOT_NODE>
Gewünschte Ausgabe
<r xmlns:s="http://www.mycompany.com/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.mycompany.com/def_schema">
<a>1234</a>
<s:b>34567</s:b>
<c>7.123456</c>
</r>