Subject: [xsl] I need to make sure that all namespace declarations get output to a particular element, not the document element From: "bryan rasmussen" <rasmussen.bryan@xxxxxxxxx> Date: Thu, 22 Mar 2007 13:51:28 +0100 |
I have a situation where the processor is obviously optimising namespace creation and placing them all over the place, unfortunately I need to place them exactly on a particular element.
<xsl:template match="/"> <office:document-content office:version="1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:te="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:tb="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datas:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms"
<xsl:call-template name="script"/> <xsl:call-template name="fontfaces"/> <xsl:call-template name="styles"/> <office:body> <office:text> <xsl:apply-templates select="ns:node-set($instancedocument)/*" mode="toplevel"/> </office:text> </office:body> </office:document-content> </xsl:template>
the template that handles toplevel matching does a lot of ordering of the document and uses <xsl:copy-of select="self::*"/> to output the actual instance inside of an xforms:model element:
<xforms:model id="Invoice" xmlns:n="nodesetvariables" xmlns:in="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"> <xforms:instance id="Instance_1"> <in:Invoice>
unfortunately I absolutely need to have xmlns:in to show up on the in:Invoice element (as well as a couple other namespace declarations) if I expect this to work with Open Office (rant about Open Office / xforms omitted for sake of not making people go insane)
So how should I best accomplish this, should I exclude namespace at the top of my stylesheet, thus forcing the processor to put it back in elsewhere (doesn't actually seem to work because hey I need to control exactly where my namespace gets put. nothing else will do. )
please note that the instance does absolutely 100% have the namespace declared in its document element, when it gets passed to the template matching the document element that document element looks like this:
<in:Invoice xmlns:fnx="http://rep.oio.dk/funx" xmlns:n="nodesetvariables" xmlns:fnc="http://rep.oio.dk/funx/fnc" xmlns:att="http://rep.oio.dk/funx/att" xmlns:template="http://rep.oio.dk/ubl/templatingsystem" xmlns:in="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xe="http://rep.oio.dk/tools/xformsExtension" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:te="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:tb="urn:oasis:names:tc:opendocument:xmlns:table:1.0">
Cheers, Bryan Rasmussen
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] State of Browser Support , Robert Koberg | Thread | Re: [xsl] I need to make sure that , G. Ken Holman |
Re: [xsl] State of Browser Support , Robert Koberg | Date | Re: [xsl] I need to make sure that , G. Ken Holman |
Month |