Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Re: XSLT - Resolving default namespace name at run time.

Reply
Thread Tools

Re: XSLT - Resolving default namespace name at run time.

 
 
Dimitre Novatchev
Guest
Posts: n/a
 
      07-26-2003
See for example:
"Handling default namespaces" by Mark Bosley
http://www.topxml.com/people/bosley/defaultns.asp



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL



"wooks" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> I have seen what i think is an answer in an FAQ but did not understand
> it. Can anyone help?



 
Reply With Quote
 
 
 
 
Dimitre Novatchev
Guest
Posts: n/a
 
      07-26-2003
> I want to assign a default namespace to my result tree but to derive
> the namespace uri programmatically at run time(actually by extracting
> a parameter from another XML file).


Then use xsl:element.

This transformation:

<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform">

<xslutput omit-xml-declaration="yes" indent="yes"/>

<xslaram name="pDefNamespace" select="'my:defNamespace'"/>
<xsl:template match="/">
<xsl:element name="t" namespace="{$pDefNamespace}">
<xsl:element name="child" namespace="{$pDefNamespace}"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

when applied on any source.xml (ignored) produces this result:

<t xmlns="my:defNamespace">
<child/>
</t>



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
transforming xhtml to html (resolving namespace dependencies) Andy XML 9 02-03-2011 10:31 PM
Default-default namespace and localname Max XML 2 08-01-2006 04:17 PM
ERROR CS0234: The type or namespace name 'DataAccessHelper' does not exist in the namespace 'BCC' (are you missing an assembly reference?) li.eddie@gmail.com ASP .Net 0 01-06-2006 11:31 AM
Reaching into the default namespace when using another namespace. Jason Heyes C++ 1 11-19-2004 02:36 AM
Re: XSLT and default namespace in source doc Marrow XML 0 08-15-2003 06:00 AM



Advertisments