xsl-list
[Top] [All Lists]

RE: Converting XML to XML

2005-08-17 05:14:21
<xsl:template match="b">
  <xsl:element name="{normalize-space(b1)}">
    <xsl:value-of select="b0"/>
  </xsl:element>
</xsl:template>

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: ChandraShekar, A [mailto:ChandraShekar(_dot_)A(_at_)siemens(_dot_)com] 
Sent: 17 August 2005 13:08
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Converting XML to XML

 I have is requirement like :
      
Source XML:
      <a>
              <b>
                      <b0>Name1
                      </b0>
                      <b1>text
                      </b1>
              </b>
              <b>
                      <b0>Name2
                      </b0>
                      <b1>int
                      </b1>
              </b>
      </a>

Destination XML:
      <a>
              <b>
                      <text>     <!-- Based in <b1> -->
                              Name1  
                      </text>
              </b>
              <b>
                      <int>           <!-- Based in <b1> -->
                              Name2
                      </int>
              </b>
      </a>

Code please

-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com] 
Sent: Wednesday, August 17, 2005 5:07 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Converting XML to XML

Your stylesheet probably doesn't need to declare this 
namespace, so just
delete it: it's needed only when the target vocabulary is XSL-FO, but
some XSLT editors seem to declare it for you by default.

If you do need a namespace in your stylesheet that you don't 
want copied
into the result document, use the exclude-result-prefixes attribute to
exclude it.

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: ChandraShekar, A [mailto:ChandraShekar(_dot_)A(_at_)siemens(_dot_)com]
Sent: 17 August 2005 12:17
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Converting XML to XML

 Hello,

   I have written small program to convert XML to XML.
   But each XML tag contains
xmlns:fo="http://www.w3.org/1999/XSL/Format"; as a attribute. How to 
avoid this?


-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com]
Sent: Wednesday, August 17, 2005 4:40 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Converting XML to XML

 

  Is it possible to convert XML to XML using XSLT ?

Yes, that's precisely what XSLT does.


In my case Source is :
<a>
<b>
</b>
<c>
</c>
</a>

Destination is :

<x>
<y>
</y>
<z>
</z>
</x>

Please provide me some sample code.
  
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="a">
  <x><xsl:apply-templates/></x>
</xsl:template>

<xsl:template match="b">
  <y><xsl:apply-templates/></y>
</xsl:template>

<xsl:template match="c">
  <z><xsl:apply-templates/></z>
</xsl:template>

</xsl:stylesheet>


Michael Kay
http://www.saxonica.com/




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>