Empty namespace from template

Posted on 2011-05-13
Last Modified: 2013-11-18

I have a very simple template that I call that populates option elements, it works fine but also inserts empty namespaces's

The xslt creates a page that is XHTML 1.0 Transitional.

<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system=""/>

I would like to understand why this is and how can I fix this.

<xsl:template name="forOptionsDown">
      <xsl:param name="maxOpt"/>
            <xsl:if test="$maxOpt &gt; 1">
                  <xsl:call-template name="forOptionsDown">
                        <xsl:with-param name="maxOpt" select="$maxOpt - 1"/>
            <option value="{(($y + 1) - $maxOpt)}"><xsl:value-of select="(($y + 1) - $maxOpt)"/></option>

I'll appreciate any help in understanding this as I have had this happen a lot and would like to understand why.


Question by:Bill_Harrison
    LVL 60

    Accepted Solution

    what do you mean with empty namespace?
    I assume

    That happens because you are creating an element in the null namespace
    and the element in which you create this has a default namespace other than the null namespace
    so there is no other option for the processor for undoing the namespace but adding an xmlns=""

    you need to create this element in the same namespace of its parent
    something like this
    <option xmlns="" value="{(($y + 1) - $maxOpt)}"><xsl:value-of select="(($y + 1) - $maxOpt)"/></option>

    Author Closing Comment

    Thanks Gertone

    I think I understand now, that really helps.

    Much appreciated.
    LVL 60

    Expert Comment

    by:Geert Bormans

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
    Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
    The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now