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

RE: XSLT and Default namespaces

Subject: RE: XSLT and Default namespaces
From: Eckenberger Axel <Extern.Eckenberger@xxxxxxxx>
Date: Fri, 6 Oct 2000 09:59:15 +0200
xslt copy default namespace xmlns
Raimond,

first of all, what parser are you using ??? I guess it's the MS one as in
the second question you refer to their implementation.

Now, if you using the MS parser in the July version there is a problem with
the namespace implementation. I haven't tested the new version (September)
to that respect yet ... but MS said that they fixing it ...

Try this as a workaround in the meanwhile

	<xsl:copy-of select="*[local-name='a']/*[local-name='b']"/>

I think name() should work as well in this case (default namespace).

I post you a message I sent to the list some time ago that contains a
description of the problem and some test code (anyone else interested send
me a mail).

Axel

> -----Original Message-----
> From: Raimond Brookman [mailto:nucleon@xxxxxxxxxx]
> Sent: Thursday, October 05, 2000 9:03 PM
> To: xsl-list@xxxxxxxxxxxxxxxx
> Subject: XSLT and Default namespaces
> 
> 
> Hi,
> 
> I want to transform an xml document that has declared a namespace, for
> example:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <test xmlns="myns">
>  <a>
>   <b></b>
>  </a>
> </test>
> 
> The corresponding XSLT is:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>  <xsl:output method="xml" version="1.0" encoding="UTF-8" 
> indent="yes"/>
> 
>  <xsl:template match="/">
>   <xsl:copy-of select="a/b"/>
>  </xsl:template>
> </xsl:stylesheet>
> 
> The resulting output document is empty.
> When i dont use a default namespace and prefix the root 
> elements in the
> source document, and also declare the namespace in the XSL 
> and use it in my
> X-path, it works:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <x:test xmlns:x="myns">
>  <a>
>   <b></b>
>  </a>
> </x:test>
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  xmlns:x="myns">
>  <xsl:output method="xml" version="1.0" encoding="UTF-8" 
> indent="yes"/>
> 
>  <xsl:template match="/">
>   <xsl:copy-of select="x:test/a/b"/>
>  </xsl:template>
> </xsl:stylesheet>
> 
> Result:
> <?xml version="1.0" encoding="UTF-16"?>
> <b xmlns:x="myns"></b>
> 
> So, after this lengthy introduction the following questions:
> 1. Is there a way to make this work without having to 
> contantly prefix all
> my xpath queries
> 2. Secondly, MS has come up with XDR, which is declared as follows:
>     xmlns="x-schema:myschema.xdr"
>     The problem is, that automatic validating happens in this 
> case in tools
> such as XML spy. I cant find a way to declare that namespace 
> inside an XSLT
> without having problems running the XLST because validation 
> kicks in.....
> 
> Anybody know some workarounds for these things?
> 
> Grtz,
> Raimond
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.