Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74482

Re: xslt with python

X-Received by 10.50.171.134 with SMTP id au6mr2403610igc.7.1405429973839; Tue, 15 Jul 2014 06:12:53 -0700 (PDT)
X-Received by 10.182.131.201 with SMTP id oo9mr15164obb.24.1405429973726; Tue, 15 Jul 2014 06:12:53 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!h18no1944598igc.0!news-out.google.com!bp9ni210igb.0!nntp.google.com!h18no1944590igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Tue, 15 Jul 2014 06:12:53 -0700 (PDT)
In-Reply-To <mailman.11833.1405415553.18130.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=149.173.1.45; posting-account=N0LDbQoAAADbFrhcL4Vyvhxzh6UNKi_p
NNTP-Posting-Host 149.173.1.45
References <mailman.11833.1405415553.18130.python-list@python.org>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <ddfb29d5-8119-4eae-917f-6fca4930e7e1@googlegroups.com> (permalink)
Subject Re: xslt with python
From Tim <jtim.arnold@gmail.com>
Injection-Date Tue, 15 Jul 2014 13:12:53 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.python:74482

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

xslt with python varun bhatnagar <varun292006@gmail.com> - 2014-07-15 10:10 +0200
  Re: xslt with python Tim <jtim.arnold@gmail.com> - 2014-07-15 06:12 -0700
    Re: xslt with python varun bhatnagar <varun292006@gmail.com> - 2014-07-15 15:58 +0200

csiph-web