Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74992
| Date | 2014-07-22 13:38 +0200 |
|---|---|
| Subject | Removing xml element and strip extra space |
| From | varun bhatnagar <varun292006@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12178.1406029458.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
Hi,
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"?>
<testNode>
<nodeInfo>
<nodePeriod nodeTime="600000000"/>
<nodeBase base="0" />
</nodeInfo>
</testNode>
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="
http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/testNode/nodeInfo/nodeBase">
</xsl:template>
</xsl:stylesheet>
When I execute it my output looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<testNode>
<nodeInfo>
* <nodePeriod nodeTime="600000000"/>*
* </nodeInfo>*
</testNode>
I want to strip the space between *<nodePeriod>* and *</nodeInfo>*
Can anyone suggest a way out to do that?
Thanks,
BR,
Varun
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Removing xml element and strip extra space varun bhatnagar <varun292006@gmail.com> - 2014-07-22 13:38 +0200
csiph-web