[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

I need to make sure that all namespace declarations ge

Subject: 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 need to make sure that all namespace declarations ge
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.

The relevant steps of the transformation are:

<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:

which looks like this when it comes out


<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">

I cannot use xslt 2.0 for this project.

Cheers,
Bryan Rasmussen

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.