Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'output': 0.05; 'that?': 0.05; 'removes': 0.07; '<?xml': 0.09; '22,': 0.09; 'subject:extra': 0.09; 'subject:xml': 0.09; 'trailing': 0.09; 'cc:addr:python-list': 0.11; 'suggest': 0.14; 'added.': 0.16; 'carriage': 0.16; 'newlines': 0.16; 'preserving': 0.16; 'removed:': 0.16; 'scrape': 0.16; 'skip:n 50': 0.16; 'suggestion.': 0.16; 'tim,': 0.16; 'whitespace.': 0.16; 'for?': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'written': 0.21; '8bit%:5': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'skip:e 30': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'this:': 0.26; 'header:In- Reply-To:1': 0.27; 'tried': 0.27; 'function': 0.29; 'tim': 0.29; 'xml': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'work.': 0.31; 'getting': 0.31; 'file:': 0.31; 'strip': 0.31; 'way?': 0.31; 'anyone': 0.31; 'file': 0.32; 'there.': 0.32; 'handled': 0.32; 'url:python': 0.33; 'skip:& 30': 0.33; 'actual': 0.34; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'url:listinfo': 0.36; 'thanks': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'skip:& 10': 0.38; 'thank': 0.38; 'pm,': 0.38; 'does': 0.39; 'itself': 0.39; 'space': 0.40; 'url:mail': 0.40; 'remove': 0.60; 'blank': 0.60; 'removing': 0.60; 'skip:n 30': 0.60; 'skip:\xc2 10': 0.60; 'mentioned': 0.61; 'skip:* 10': 0.61; "you're": 0.61; 'july': 0.63; 'to:addr:gmail.com': 0.65; 'between': 0.67; 'default': 0.69; 'construction': 0.72; 'jul': 0.74; '\xc2\xa0\xc2\xa0': 0.74; 'skip:n 40': 0.81; '3:00': 0.84; 'br,': 0.84; 'monte': 0.84; 'returns.': 0.84; 'subject:space': 0.84; 'xslt': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=XC7cNmsnN2VfjLefVZtEv5sthkIwvzM/3dqkj8bowo4=; b=Fqo1USlB6K3+LVw8KmXvmAxp98t19DunbqaQFctJR99/j84fg4tNHuvFnnKPOWxAN3 KQPNDSfq6fdGu0QiJtlGepGT19AaiTwHryCmuYNO9gBdD2aEhbZWnDKIFMedLY0pjT3G E/FwMFT8Q1PePGfbwAcgqVDq6dEebASIYv/Cz/b7t/oO8LgUpwuF9WtEzciFOuzmMTCj 4IiTnwkwrCV3ijkmy9OWsK+1skEgBjlAmSx8NARjLSbcQ+D14qgEZm77BJrPi7/X/uMx uaJVDFeyBSesZVpt4FH6tJ45Z/dp09DmEaOX31kuMBeOq1yVGFnZe+2IAuEJD59nThjc eg4w== MIME-Version: 1.0 X-Received: by 10.236.141.80 with SMTP id f56mr4715693yhj.149.1406036560863; Tue, 22 Jul 2014 06:42:40 -0700 (PDT) In-Reply-To: <7597f8b7-2989-44f2-804b-c3dc5c0e6154@googlegroups.com> References: <7597f8b7-2989-44f2-804b-c3dc5c0e6154@googlegroups.com> Date: Tue, 22 Jul 2014 15:42:40 +0200 Subject: Re: Removing xml element and strip extra space From: varun bhatnagar To: Tim Content-Type: multipart/alternative; boundary=20cf303635bbc0668d04fec865c8 Cc: python-list@python.org 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: 197 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1406036570 news.xs4all.nl 2889 [2001:888:2000:d::a6]:44485 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74996 --20cf303635bbc0668d04fec865c8 Content-Type: text/plain; charset=UTF-8 Hi Tim, Thanks for replying. No that is not the output I am looking for. I just want to scrape out But the way I have written my xsl file it is removing it but it is also leaving a blank space there. I want my output to look like this: ** ** But in actual it is showing like this: <---------------------------- *I want to remove this space* :) On Tue, Jul 22, 2014 at 3:00 PM, Tim wrote: > On Tuesday, July 22, 2014 8:53:35 AM UTC-4, varun bhatnagar wrote: > > Hi, > > Thank you so much for the suggestion. > > I tried using the rstrip() function but that did not work. Still getting > a blank space between and as mentioned in the > above output xml file: > > > > > > Is there any other way through which this can be achieved? Can't this be > handled by xslt itself in some way? > > > > Thanks, > > > > BR, > > Varun > > On Tue, Jul 22, 2014 at 2:23 PM, Monte Milanuk > wrote: > > On 2014-07-22, varun bhatnagar wrote: > > > I want to strip the space between ** and ** > > > Can anyone suggest a way out to do that? > > Look at str.rstrip() - by default it removes trailing whitespace > > including carriage returns. > > -- > > Hi Varun, > The whitespace is part of your original xml; the xslt is only preserving > that whitespace. Do you have any control over the construction of that > original xml? > > It looks like it has been tidied and whitespace perhaps added. I think you > will get what you want if the original has the newlines removed: > > > > > > > does that get you what you're looking for? Is the whitespace actually > necessary in the original or problematic in the result? > > --Tim Arnold > -- > https://mail.python.org/mailman/listinfo/python-list > --20cf303635bbc0668d04fec865c8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Tim,

Thanks for replying.
= No that is not the output I am looking for.

I just= want to scrape out=C2=A0<nodeBase base=3D"0" /= >
But the way I have written my xsl file it is removing it but it is= also leaving a blank space there. I want my output to look like this:

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


But in actual it is showing like this:

<?xml version=3D"1.0" encoding=3D&q= uot;UTF-8"?>
<testNode>= ;
<nodeInfo><= br style=3D"font-family:arial,sans-serif;font-size:13px"> <nodePeriod = nodeTime=3D"600000000"/>
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <---------------------------- I want = to remove this space :)=C2=A0
</nodeInfo>
</testNode>



On Tue, Jul 22, 2014 at 3:00 PM, Tim <= jtim.arnold@gmail.com> wrote:
On Tuesday, July 22, 2014 8:= 53:35 AM UTC-4, varun bhatnagar wrote:
> Hi,
> Thank you so much for the suggestion.
> I tried using the rstrip() function but that did not work. Still getti= ng a blank space between=C2=A0<nodePeriod>=C2=A0and=C2=A0</nodeInf= o> as mentioned in the above output xml file:
> <nodePeriod nodeTime=3D"600000000"/= > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0
> =C2=A0</nodeInfo>
> Is there any other way through which this can be= achieved? Can't this be handled by xslt itself in some way?
>
> Thanks,
>
> BR,
> Varun
> On Tue, Jul 22, 2014 at 2:23 PM, Monte Milanuk &= lt;memi...@invalid.com> wrote= :
> On 2014-07-22, varun bhatnagar <varun...@gmail.com> wrote:
> > I want to strip the space between *<nodePeriod>* and *</= nodeInfo>*
> > Can anyone suggest a way out to do that?
> Look at str.rstrip() - by default it removes trailing whitespace
> including carriage returns.
> --

Hi Varun,
The whitespace is part of your original xml; the xslt is only preserving th= at whitespace. Do you have any control over the construction of that origin= al xml?

It looks like it has been tidied and whitespace perhaps added. I think you = will get what you want if the original has the newlines removed:
<?xml version=3D"1.0" encoding=3D"UTF-8&q= uot;?>
<testNode>
<nodeInfo>
<nodePeriod nodeTime=3D"600000000"/><nodeBase base=3D&qu= ot;0" /></nodeInfo>
</testNode>

does that get you what you're looking for? Is the whitespace actu= ally necessary in the original or problematic in the result?

--Tim Arnold
--
https://mail.python.org/mailman/listinfo/python-list

--20cf303635bbc0668d04fec865c8--