Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed0.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!87.79.20.101.MISMATCH!newsreader4.netcologne.de!news.netcologne.de!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'tutorial': 0.03; 'root': 0.05; 'transform': 0.07; 'executed': 0.09; 'merging': 0.09; 'snippet': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '(directly': 0.16; 'copied.': 0.16; 'eclipse': 0.16; 'fine.': 0.16; 'fly': 0.16; 'merged': 0.16; 'tim,': 0.16; 'url:faq': 0.16; 'subject:python': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'trying': 0.19; 'written': 0.21; 'example': 0.22; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'rules': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'creating': 0.23; 'merge': 0.24; 'platform,': 0.24; 'skip:e 30': 0.24; 'fine': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; '15,': 0.26; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'tim': 0.29; 'xml': 0.29; 'message- id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'getting': 0.31; 'reply.': 0.31; 'that.': 0.31; 'dom': 0.31; 'file': 0.32; 'me?': 0.32; 'url:python': 0.33; 'copying': 0.34; 'subject:with': 0.35; 'created': 0.35; 'problem.': 0.35; 'something': 0.35; 'anybody': 0.35; 'equal': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'described': 0.36; 'executing': 0.36; 'url:listinfo': 0.36; 'doing': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'changing': 0.37; 'two': 0.37; 'pm,': 0.38; 'skip:& 20': 0.39; 'skip:p 20': 0.39; 'url:mail': 0.40; 'how': 0.40; 'first': 0.61; 'here:': 0.62; 'july': 0.63; 'to:addr:gmail.com': 0.65; 'details': 0.65; 'close': 0.67; 'below:': 0.68; 'jul': 0.74; 'br,': 0.84; 'pasting': 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=6oKLn+Q1l2xLR9akduoD9WKwSap5zQojorondfQNfVw=; b=dfQpL1gN/cr98rJQomF5v6jlz2awVsCuRP2yUAwaLsoXDLEDvc5Kh8ZQIyZ7JXfHLo iosVnU0sTPvOQ5DuVuDMKcAvJJ3WU0NiWp+Ya5slvGqVm7+W7uxwDvEtr4anR0K00JwC o3PlmArHlrn2b2PUSdzv/AVo5FytY/DGVI1fy5lMtfZZ6eOW6g3hLzbnQcHhROlkYODg 5A+a0BamsDX4qUeaGLWnwK23jPlAnqrAsJeUyzMW4qcyC0SFv+zJo2wyThdNJpkdC7Pv 8G/ht+3nZA4qftcIftIj9Mgcp6sWUJ9sHkUmlIxG48RJ49hbgeUG99WUwSOFtPwkZN95 8VOQ== MIME-Version: 1.0 X-Received: by 10.236.83.103 with SMTP id p67mr17809892yhe.89.1405432737737; Tue, 15 Jul 2014 06:58:57 -0700 (PDT) In-Reply-To: References: Date: Tue, 15 Jul 2014 15:58:57 +0200 Subject: Re: xslt with python From: varun bhatnagar To: Tim Content-Type: multipart/alternative; boundary=20cf301af2c316b22f04fe3bcfa5 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: 114 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1405432747 news.xs4all.nl 2907 [2001:888:2000:d::a6]:53223 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74485 --20cf301af2c316b22f04fe3bcfa5 Content-Type: text/plain; charset=UTF-8 Hi Tim, Thanks a lot for the reply. I think I got the root cause of the problem. Before merging I am creating one dummy xml file on the fly and I am copying the content of first xml into that. This dummy file I am mentioning in xsl file and the URI is changing because of which it is not getting merged. I have to see how can I resolve the URI problem. //Varun On Tue, Jul 15, 2014 at 3:12 PM, Tim wrote: > On Tuesday, July 15, 2014 4:10:57 AM UTC-4, varun bhatnagar wrote: > > I am trying to merge two xmls using xslt in python but the content of > first xml is not getting copied. The rules written in xsl file created are > correct because if I am executing it without python (directly from eclipse > as I have xslt plugin installed) it is getting merged fine. Can anybody > help me? I am pasting my code snippet below: > > > > import lxml.etree as ET > > dom = ET.parse(r'test_file_2.xml') > > xslt = ET.parse(r'TestMergeRules.xsl') > > transform = ET.XSLT(xslt) > > print transform > > > > newdom = transform(dom) > > print(ET.tostring(newdom, pretty_print=True)) > > > > I am opening other xml file (test_file_1.xml) in xsl file using > "document()" function. > > > > Once this code is executed I can see only the content of test_file_2.xml. > > Am I doing something wrong? Is there any other way to do this because my > xslt rules are working fine without python. > > > Hi BR, > Your code looks very close but not exactly equal to the tutorial here: > http://lxml.de/xpathxslt.html#xslt > > Can you try the example on that page and report the results? > Plus your platform, python version and lxml details as described here: > http://lxml.de/FAQ.html#i-think-i-have-found-a-bug-in-lxml-what-should-i-do > > thanks, > --Tim Arnold > -- > https://mail.python.org/mailman/listinfo/python-list > --20cf301af2c316b22f04fe3bcfa5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Tim,

Thanks a lot for the reply. I t= hink I got the root cause of the problem.
Before merging I am cre= ating one dummy xml file on the fly and I am copying the content of first x= ml into that. This dummy file I am mentioning in xsl file and the URI is ch= anging because of which it is not getting merged.
I have to see how can I resolve the URI problem.

<= div>
//Varun


On Tue, Jul 15, 2014 at 3:12 PM, Tim <jtim.ar= nold@gmail.com> wrote:
On T= uesday, July 15, 2014 4:10:57 AM UTC-4, varun bhatnagar wrote:
> I am trying to merge two xmls using xslt in python but the content of = first xml is not getting copied. The rules written in xsl file created are = correct because if I am executing it without python (directly from eclipse = as I have xslt plugin installed) it is getting merged fine. Can anybody hel= p me? I am pasting my code snippet below:
>
> import lxml.etree as ET
> dom =3D ET.parse(r'test_file_2.xml')
> xslt =3D ET.parse(r'TestMergeRules.xsl')
> transform =3D ET.XSLT(xslt)
> print transform
>
> newdom =3D transform(dom)
> print(ET.tostring(newdom, pretty_print=3DTrue))
>
> I am opening other xml file (test_file_1.xml) in xsl file using "= document()" function.
>
> Once this code is executed I can see only the content of test_file_2.x= ml.
> Am I doing something wrong? Is there any other way to do this because = my xslt rules are working fine without python.
>
Hi BR,
Your code looks very close but not exactly equal to the tutorial here:
http://lxm= l.de/xpathxslt.html#xslt

Can you try the example on that page and report the results?
Plus your platform, python version and lxml details as described here:
http://lxml.de/FAQ.html#i-think-i-have-found= -a-bug-in-lxml-what-should-i-do

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

--20cf301af2c316b22f04fe3bcfa5--