Subject: Re: [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 15:03:23 +0100 |
I've not heard of a processor moving a required namespace declaration "up" the result tree. Once an element in the result tree is constructed, the adding of children nodes to the element wouldn't typically change the completed parent element.
But you are missing showing us the declaration at the top and the namespaces in the stylesheet document element ... are you declaring the "xmlns:in" namespace there?
Your output indicates to me that an ancestor of the xforms:model element in your stylesheet has the invoice namespace. That is assuming the xforms:model comes from a literal result element in your stylesheet.
<xsl:template name="xformsgeneration"> <xforms:model id="{$docElemlocalName}"> <xforms:instance id="Instance_1"> <xsl:copy-of select="self::*"/> </xforms:instance> <xforms:bind id="Binding0" required="true()"></xforms:bind> <xsl:apply-templates mode="buildform"> <xsl:with-param name="inpath" select="'\\\'"/> <xsl:with-param name="id" select="1"/> </xsl:apply-templates> <xsl:call-template name="createdocument"> <xsl:with-param name="docname" select="$docElemlocalName"/> </xsl:call-template> </xforms:model> </xsl:template>
<in:Invoice xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:in="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" 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: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:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:xe="http://rep.oio.dk/tools/xformsExtension"
<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> <ext:UBLExtensions ....
>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. )
Sometimes I have used techniques such as:
<xsl:template name="do-invoice" match="in:Invoice" xmlns:in="...."> <in:Invoice ...> </xsl:template>
... so as to focus the use of namespaces in my stylesheet.
Alternatively, one might use an imported or included stylesheet in which the UBL namespaces are declared, but not in the importing or including stylesheet.
Cheers, Bryan Rasmussen
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] I need to make sure that , G. Ken Holman | Thread | Re: [xsl] I need to make sure that , David Carlisle |
Re: [xsl] I need to make sure that , David Carlisle | Date | Re: [xsl] I need to make sure that , bryan rasmussen |
Month |