Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-978

namespace problem with xsl:copy-of inside xsl:element

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Fixed
    • 2.7.1
    • None
    • None
    • Operating System: All
      Platform: All
    • 8473

    Description

      Santiago Pericas-Geertsen discovered the following namspace problem
      with Xalan.

      Using the following stylesheet

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

      <xsl:template match="root">
      <xsl:variable name="x"><hello/></xsl:variable>

      <xsl:element name="literalName" namespace="http://literaluri">
      <xsl:copy-of select="$x"/>
      </xsl:element>
      </xsl:template>

      </xsl:stylesheet>

      Xalan outputs the following

      <?xml version="1.0" encoding="UTF-8"?>
      <literalName xmlns="http://literaluri"><hello/></literalName>

      But the correct output would be either

      <?xml version="1.0" encoding="utf-8"?><literalName
      xmlns="http://literaluri"><hello xmlns=""/></literalName>

      or

      <?xml version="1.0" encoding="UTF-8" ?>
      <ns0:literalName xmlns:ns0="http://literaluri"><hello/></ns0:literalName>

      Attachments

        Activity

          People

            Unassigned Unassigned
            tom.amiro@sun.com Tom Amiro
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: