Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.040 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'output': 0.05; 'that?': 0.05; 'transform': 0.07; '<?xml': 0.09; 'subject:extra': 0.09; 'subject:xml': 0.09; 'python': 0.11; 'suggest': 0.14; 'element.': 0.16; 'thanks,': 0.17; 'trying': 0.19; '8bit%:5': 0.22; 'skip:e 30': 0.24; 'looks': 0.24; 'this:': 0.26; 'xml': 0.29; 'message- id:@mail.gmail.com': 0.30; 'strip': 0.31; 'anyone': 0.31; 'file': 0.32; 'skip:m 30': 0.32; 'another': 0.32; 'skip:& 30': 0.33; 'skip:s 30': 0.35; 'received:google.com': 0.35; 'hi,': 0.36; 'url:org': 0.36; 'skip:& 10': 0.38; 'skip:m 40': 0.38; 'to:addr :python-list': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'space': 0.40; '8bit%:6': 0.40; 'how': 0.40; 'remove': 0.60; 'deleting': 0.60; 'skip:n 30': 0.60; 'tag': 0.61; 'between': 0.67; 'below:': 0.68; '\xc2\xa0\xc2\xa0': 0.74; 'url:1999': 0.75; 'br,': 0.84; 'subject:space': 0.84; '8bit%:18': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=564RxUHt7bLQKp3JeNlqXgImxEkwBK6CJ1dO1NoLrEQ=; b=C5XCkia9vjBig983YaZD7TT1IHhHywLCS3f5zG3DgKG4MIH1pZAamKwaKn5k5/l/Ou /nv3ERzkAHGNyVgS9hwNGok5yIif+FY54yx1f2GDTPXkI9OFAi+toGXxP4L8wuc4suoc W74sb1FHYJAVf4A7/2sCXhIltxznzrbp7c8vZgzsd1KkuIa1pLSFjY6/lEB0FU38g4Tp IgZFJLMBeovQgHuXSzPwGKmfCMdDYzc+CzIPDR779nRzLULtJtVhX9gXZc0mAD/6QHzn fBNgzb+iTYXBakcy6/AlnlCIb3SUGVgHax3zT4FEYCrnL2vvRsVaohbtLTsDprwAq3h6 jOQA== MIME-Version: 1.0 X-Received: by 10.236.83.103 with SMTP id p67mr39004591yhe.89.1406029106233; Tue, 22 Jul 2014 04:38:26 -0700 (PDT) Date: Tue, 22 Jul 2014 13:38:26 +0200 Subject: Removing xml element and strip extra space From: varun bhatnagar To: python-list@python.org Content-Type: multipart/alternative; boundary=20cf301af2c36bc7b004fec6a942 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 139 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1406029458 news.xs4all.nl 2870 [2001:888:2000:d::a6]:54288 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74992 --20cf301af2c36bc7b004fec6a942 Content-Type: text/plain; charset=UTF-8 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: I want to remove the tag and this is how my xsl file looks like: When I execute it my output looks like this: * * * * I want to strip the space between ** and ** Can anyone suggest a way out to do that? Thanks, BR, Varun --20cf301af2c36bc7b004fec6a942 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
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=3D"1.0" encoding=3D"UTF-8"?>
<testNode>
<nodeInfo>
<= div style=3D"font-family:arial,sans-serif;font-size:13px"> =C2=A0 =C2=A0 =C2=A0 <nodePeriod nodeTime=3D&quo= t;600000000"/>
=C2=A0 =C2=A0 =C2=A0 <nodeBas= e base=3D"0" />
=C2=A0 =C2=A0 </nodeInfo>
</testNode&g= t;


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

<?xml version=3D"1.0" encoding=3D"UTF-8"?>=
<xsl:stylesheet version=3D"1.0" x= mlns:xsl=3D"http://www.w3.org/1999/XSL/Transform">
<xsl:output method=3D"xml" indent=3D= "yes"/>

= =C2=A0 <xsl:template match=3D"@*|node()">
= =C2=A0 =C2=A0 <xsl:copy>
=C2=A0 =C2=A0 =C2=A0 <xsl:apply-templates select=3D= "@*|node()"/>
=C2=A0 =C2=A0 </xsl:copy>
=C2=A0 </xsl:template>
=C2=A0=C2=A0
=C2=A0=C2=A0
<xsl:template mat= ch=3D"/testNode/nodeInfo/nodeBase">
</xsl:template>

</xsl:stylesheet>

When I execute it my output looks li= ke this:

<?xml version=3D"1.0" en= coding=3D"UTF-8"?>
<testNode>
<nodeInfo>
= =C2=A0 =C2=A0 =C2=A0 <nodePeriod nodeTime=3D"600000000"/>
=C2=A0 =C2=A0 =C2=A0=C2=A0
=C2=A0 =C2=A0 </nodeInfo><= /div>
</testNode>

I want to strip the space between=C2=A0<nodePeriod>=C2= =A0and=C2=A0</nodeInfo>
Can anyone suggest a way out to do that?

Thanks,
BR,
Varun
--20cf301af2c36bc7b004fec6a942--