RE: [xsl] Transferring xmlns aliases to result tree.

Subject: RE: [xsl] Transferring xmlns aliases to result tree.
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sat, 7 Jun 2003 18:06:27 +0100
When you use a literal result element, the element that is created in
the result tree should have namespace declarations for all the
namespaces that were in scope for the literal result element in the
stylesheet.

It's difficult to tell from your example, but perhaps you are declaring
the namespace "impl" in the source document and using the prefix "impl:"
in the stylesheet? That won't work. If it's used in the stylesheet it
must be declared in the stylesheet.

Michael Kay


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Tom Rybak
> Sent: 06 June 2003 17:39
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Transferring xmlns aliases to result tree.
> 
> 
> Sure, here's the definition.
> 
> <wsdl:definitions targetNamespace="http://someurl/"; 
> xmlns="http://schemas.xmlsoap.org/wsdl/"; xmlns:impl="http://someurl/";>
> 
> So, the problem is that someType is defined within the WSDL 
> document as
> 
> <complexType name="someType">
> </complexType>
> 
> so it ends up being defined in targetNamespace, which is 
> equivalent to the impl namespace. This type is later used by 
> the line I gave before.
> 
> <element name="someElement" type="impl:someType"/>
> 
> and is referred to as impl:someType. What I meant when I said 
> "appears as text" is that "impl" is only used withing the txt 
> value of the type attribute. It's never explicitly used in 
> the name of an element or the name of an attribute. Hence, it 
> is never evaluated by the xslt engine, and the namespace 
> alias is not copied into the result tree.
> 
> I have tried the following.
> 
> <xsl:for-each select="namespace::*">
> 	<xsl:copy/>
> </xsl:for-each>
> 
> But, it does not work very well, since the attribute will be 
> copied over as 'impl="http://someurl/";' and not as 
> 'xmlns:impl="http://someurl/";'.
> 
> -----Original Message-----
> From: Lars Huttar [mailto:lars_huttar@xxxxxxx]
> Sent: Friday, June 06, 2003 12:40 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Transferring xmlns aliases to result tree.
> 
> 
> > I am having trouble transferring the xml namespace aliases
> > from a source tree to the result tree. Specifically I would 
> > like to transfer some aliases that are used only within the 
> > value of an attribute.
> > 
> > <element name="someElement" type="impl:someType"/>
> > 
> > I have a mapping at the top of the document for impl, but
> > it's not used anywhere else except the type attribute. Is 
> > there a way to force this mapping to appear in the result 
> > tree? It does not seem to be transferred. I assume it's 
> > because it appears as text.
> 
> What do you mean, it appears as text?
> 
> Can you show us your declaration of the "impl" prefix
> at the top of the document?
> 
> Lars
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
>  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