Re: [xsl] Problem involving xmlns namespace declaration in source xml

Subject: Re: [xsl] Problem involving xmlns namespace declaration in source xml
From: omprakash.v@xxxxxxxxxxxxx
Date: Wed, 26 Apr 2006 11:54:22 +0530
Hi,
        The following link explains the way to resolve this.

http://www.topxml.com/people/bosley/defaultns.asp

cheers,
prakash
http://www.bonanzasoft.com





                                                                                                                                 
                      "Pankaj Bishnoi"                                                                                           
                      <pankaj.bishnoi@a         To:      <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>                                       
                      deptia.com>               cc:      (bcc: omprakash.v/Polaris)                                              
                                                Subject: [xsl] Problem involving xmlns namespace declaration in source xml       
                      04/26/2006 11:32                                                                                           
                      AM                                                                                                         
                      Please respond to                                                                                          
                      xsl-list                                                                                                   
                                                                                                                                 
                                                                                                                                 




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





POLARIS, THE LEADER IN SPECIALITY APPLICATION DEVELOPMENT :
-------------------------------------------------------------

Polaris has been awarded the Leader in the category of "Speciality Application Development" among the Top 100 global Companies from Cyber Media Publications for the Year 2006.

--------------------------------------------------------------

This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

Current Thread