[Home] [By Thread] [By Date] [Recent Entries]

Subject: Problem involving xmlns namespace declaration in source xml
From: "Pankaj Bishnoi" <pankaj.bishnoi@xxxxxxxxxxx>
Date: Wed, 26 Apr 2006 11:32:12 +0530
Hi All
          I am using Xalan for doing a simple transformation. My Source Xml
is::

<?xml version="1.0"?>
<persons
xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com note.xsd">

<person>
  <full_name>Hege Refsnes</full_name>
  <child_name>Cecilie</child_name>
</person>
<person>
  <full_name>Tove Refsnes</full_name>
    <child_name>Hege</child_name>
    <child_name>Stale</child_name>
    <child_name>Jim</child_name>
    <child_name>Borge</child_name>
</person>
<person>
  <full_name>Stale Refsnes</full_name>
</person>
</persons>



and the xsl is ::::



<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.1" xmlns:java="http://xml.apache.org/xslt/java"
xmlns="http://www.w3schools.com" xmlns:str="http://exslt.org/strings"
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
extension-element-prefixes="redirect">
     <xsl:output method="xml" version="1.0" encoding="ISO-8859-1"
indent="yes"/>
      <xsl:variable name="apos">'</xsl:variable>
     <xsl:template match="/">
          <persons>
               <xsl:apply-templates select="/persons/person"
mode="_persons_person_order1"></xsl:apply-templates>
          </persons>
     </xsl:template>
     <xsl:template match="/persons/person" mode="_persons_person_order1">
          <person>
               <full_name>
                    <xsl:value-of select="full_name"/>
               </full_name>
               <child_name>
                    <xsl:value-of select="child_name"/>
               </child_name>
          </person>
     </xsl:template>
</xsl:stylesheet>


When i transform then i do not get map values in corresponding target
elements. The reason for that is in the source file for the root element
persons i am having a namespace declaration as:::
xmlns="http://www.w3schools.com" when i remove this namespace declaration
then the transfornation works fine. What is the problem that only this
namespace tag does not work.


Thanks for help in advance

Thanks
Pankaj

Current Thread
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member