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

RE: Creating namespace declarations solely for QName

Subject: RE: Creating namespace declarations solely for QName attribute values
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 16 Oct 2008 22:53:23 +0100
RE:  Creating namespace declarations solely for QName
Are you using XSLT 2.0? The xsl:namespace instruction was invented to make
this kind of job easier.

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

> -----Original Message-----
> From: Jeff Greif [mailto:jeff.greif@xxxxxxxxx] 
> Sent: 16 October 2008 22:45
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Creating namespace declarations solely for 
> QName attribute values
> 
> 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.