Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'python.': 0.02; 'transform': 0.07; 'executed': 0.09; 'snippet': 0.09; 'python': 0.11; '(directly': 0.16; 'copied.': 0.16; 'eclipse': 0.16; 'fine.': 0.16; 'merged': 0.16; 'subject:python': 0.16; 'thanks,': 0.17; 'trying': 0.19; 'written': 0.21; 'import': 0.22; 'rules': 0.22; 'merge': 0.24; 'skip:e 30': 0.24; 'fine': 0.24; 'correct': 0.29; 'xml': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'getting': 0.31; 'dom': 0.31; 'file': 0.32; 'me?': 0.32; 'subject:with': 0.35; 'created': 0.35; 'something': 0.35; 'anybody': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'executing': 0.36; 'doing': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'skip:t 30': 0.61; 'first': 0.61; 'below:': 0.68; '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:date:message-id:subject:from:to:content-type; bh=9p59P2OOiy1ou+oPmVwbSuFTVcJrMiK1tQW/NognNNY=; b=0boGfH9u4FWU5d2zL1gX1XMAzB7EFLytZpGrNeQYEFPGZTpgBe/XRIEZ7MQXg+e1uZ Uw+LFmEEhPA+YoJ9jJpll4DFUZ0EozPByFFMV3XgG+9pLiLvj2rP2TcMpmGya3UiCNN2 cgN7+wKNBt9upJuG4NrcX/85kkxJRmWf+OhAQ5MFlHQoeqYcTBIt0V7yhvK8iVZqLlos pVgTpj6Y+1HtZDk1lvDWeF9B8i1LZPTOkX2FGPZxIqdNVLDSCZz5SssqUIEreDkJumPQ 5O1617gepMMzIAhkRA7waoZkGBPAtZiBDEBGl4owLTnBzST6H+JzG2L4JKuYuCQpV2nj BuuA== MIME-Version: 1.0 X-Received: by 10.236.70.99 with SMTP id o63mr37543749yhd.114.1405411857636; Tue, 15 Jul 2014 01:10:57 -0700 (PDT) Date: Tue, 15 Jul 2014 10:10:57 +0200 Subject: xslt with python From: varun bhatnagar To: python-list@python.org Content-Type: multipart/alternative; boundary=001a11c1d11289a0cb04fe36f25e 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: 56 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1405415553 news.xs4all.nl 2905 [2001:888:2000:d::a6]:45490 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74474 --001a11c1d11289a0cb04fe36f25e Content-Type: text/plain; charset=UTF-8 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. Thanks, BR, Varun --001a11c1d11289a0cb04fe36f25e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
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 f= rom 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 =3D ET.parse(r'test_file_2.xml')
xslt =3D ET.parse(r'TestMergeRules.xsl&= #39;)
transform =3D ET.XSLT= (xslt)
print transform
newdom =3D transform(dom)
<= div>print(ET.tostring(newdom, pretty_print=3DTru= e))

I am opening other xml file (test_f= ile_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.

Thanks,
BR,
Varun


--001a11c1d11289a0cb04fe36f25e--