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

Creating namespace declarations solely for QName attr

Subject: Creating namespace declarations solely for QName attribute values
From: "Jeff Greif" <jeff.greif@xxxxxxxxx>
Date: Thu, 16 Oct 2008 14:44:30 -0700
 Creating namespace declarations solely for QName  attr
We are trying to replace namespaces consistently in the namespace
declarations of a document, thus preserving the prefixes so the QName
attribute values remain valid.

That is, given a source document like this:

<schema targetNamespace="urn:target" xmlns:t="urn:target"
xmlns:i="urn:imported">
 <import namespace="urn:imported"/>
 <element name="something" type="i:ImportedType"/>
</schema>

The key feature of this document is that no element or attribute in
the document is in either of the explicitly declared namespaces.
These namespaces are only referenced explicitly in attribute values
and implicitly in the QName-valued attribute 'type'.

The idea is to change urn:target to urn:target1 and urn:imported to
urn:imported1 (based on a map of these conversions read into the XSLT
using the document() function).  None of the namespaces involved in
this conversion can be declared in the stylesheet, but are determined
from the map.

We know how to change the value of any attribute, the namespace of any
element or attribute using this map, but we don't see yet how to
change the association of a prefix with a namespace, so that the
prefix 'i' will be associated with the namespace "urn:imported1" in
the result document, effectively changing the namespace implied by the
value of the 'type' attribute in the result document, *when there is
no element or attribute in the source document that has the namespace
corresponding to that prefix*.

We are trying to avoid having to know which are attributes with QName
values and having to transform their values to somehow conform to
prefixes used in the result doc.

Is there a way to do this in XSLT, given that matching on namespace
nodes is not possible, and we have been unable to find a way to create
namespace nodes in a template except by naming an element or attribute
using the prefix in question?  Would a solution involve creating an
attribute with the given prefix and namespace, to change the namespace
nodes of the containing element, while avoiding having the attribute
appearing in the result document?

Jeff

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.