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

Re: Global namespace prefixes (Corrected Examples)

Subject: Re: Global namespace prefixes (Corrected Examples)
From: Nathan Potter <ndp@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 13 Nov 2008 15:51:08 -0800
Re:  Global namespace prefixes (Corrected Examples)
On Nov 13, 2008, at 3:30 PM, Michael Kay wrote:


The crux of my question is this:

Is there a way to get namespace prefix declarations into the
root element of the result tree through the XSLT API?

With XSLT 2.0, use the xsl:namespace instruction



I'm stuck with XSLT 1.0



With XSLT 1.0, you can use xsl:copy-of to copy a namespace node from the
source document to the result document.

But that only works if the namespace exists in the source document.


In my situation I am using information found in the source document to create a new namespace.

The intention is that every Attribute element gets recast to a new element in a namespace that is unique to the base.document.

So these:

<?xml version="1.0" encoding="UTF-8"?>
<Dataset xmlns="http://xml.opendap.org/ns/DAP/3.2#" base="http://base.document ">
<Attribute name="Conventions" >CF-1.0</Attribute>
<Attribute name="logname" >olson</Attribute>
<Attribute name="host" >bb0001en</Attribute>
</Dataset>


Currently become this:

<?xml version="1.0" encoding="UTF-8"?>
<output xmlns:dap="http://xml.opendap.org/ns/DAP/3.2#">
<ns0:Conventions xmlns:ns0="http://base.document/att#">CF-1.0</ ns0:Conventions>
<ns1:logname xmlns:ns1="http://base.document/att#">olson</ns1:logname>
<ns2:host xmlns:ns2="http://base.document/att#">bb0001en</ns2:host>
</output>



Which is correct, but what I am trying to get is this:



<?xml version="1.0" encoding="UTF-8"?>
<output xmlns:dap="http://xml.opendap.org/ns/DAP/3.2#" xmlns:att="http://base.document/att# ">
<att:Conventions>CF-1.0</ttt:Conventions>
<att:logname>olson</att:logname>
<att:host>bb0001en</att:host>
</output>







Michael Kay
http://www.saxonica.com/


============================================================ Nathan Potter Oregon State University, COAS ndp at coas.oregonstate.edu 104 Ocean. Admin. Bldg. 541 737 2293 voice Corvallis, OR 97331-5503 541 737 2064 fax

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.