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

Re: same prefix, different namespaces (URIs)

Subject: Re: same prefix, different namespaces (URIs)
From: "Heiko Niemann" <kontakt@xxxxxxxxxxxxxxxx>
Date: Wed, 18 Nov 2009 16:51:36 +0100
Re:  same prefix
> 2009/11/18 Heiko Niemann <kontakt@xxxxxxxxxxxxxxxx>:
>> Hello,
>>
>> I need/want to use the same prefix in the result document as in the
>> source
>> document, but those prefixes need to be mapped to different URIs.
>>
>> Sample for prefix 'nsn':
>>
>> source document
>>
>> <source xmlns="http://foo.org" xmlns:nsn="http://foo.org/1999">
>>  <nsn:data>hello</nsn:data>
>> </source>
>>
>>
>> result document
>>
>> <source xmlns="http://foo.org" xmlns:nsn="http://foo.org/2009">
>>  <nsn:item>hello</nsn:item>
>> </source>
>>
>>
>> Is it possible (as shown here) to map the nsn:data element to nsn:item
>> element?
>
> It doesn't really matter what prefix you use in the stylesheet for the
> input namespace, so below I use "nsn99" for that, which frees up "nsn"
> to be used in the output:
>
> <xsl:stylesheet version="2.0"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   xmlns="http://foo.org"
>   xmlns:nsn99="http://foo.org/1999"
>   xmlns:nsn="http://foo.org/2009"
>   exclude-result-prefixes="nsn99">
>
> <xsl:template match="@*|node()">
>     <xsl:copy copy-namespaces="no">
>         <xsl:apply-templates select="@*|node()"/>
>     </xsl:copy>
> </xsl:template>
>
> <xsl:template match="nsn99:data">
> 	<nsn:item>
> 		<xsl:apply-templates select="@*|node()"/>
> 	</nsn:item>
> </xsl:template>
>
> </xsl:stylesheet>
>


The source document would be exactly the way I posted it - out of my
control. E.g. it could be the result (simplified) of a web service which I
want to transform to an input for a different web service. That input
happens to use the same prefix with a different URI mapped to. So both
document formats are out of my control. So I wonder, whether I can
accomplish what I want in one step?

Heiko

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.