Removing xml element and strip extra space

varun bhatnagar varun292006 at
Tue Jul 22 13:38:26 CEST 2014


I am trying to play around with python and xslt. I have an xml and I want
to transform it to another xml by deleting its one element. The xml is
pasted below:

<?xml version="1.0" encoding="UTF-8"?>
      <nodePeriod nodeTime="600000000"/>
      <nodeBase base="0" />

I want to remove the <nodeBase> tag and this is how my xsl file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl:output method="xml" indent="yes"/>

  <xsl:template match="@*|node()">
      <xsl:apply-templates select="@*|node()"/>

<xsl:template match="/testNode/nodeInfo/nodeBase">


When I execute it my output looks like this:

<?xml version="1.0" encoding="UTF-8"?>
*      <nodePeriod nodeTime="600000000"/>*

*    </nodeInfo>*

I want to strip the space between *<nodePeriod>* and *</nodeInfo>*
Can anyone suggest a way out to do that?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list