Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75370
| Date | 2014-07-30 14:16 +0200 |
|---|---|
| Subject | How to loop through nodes of xml through xslt |
| From | varun bhatnagar <varun292006@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12432.1406722601.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
Hi, I have two xml files. *File1.xml* *<?xml version="1.0" encoding="UTF-8"?>* *<InfoTag>* *<Procedure attrProc="TestProcA" attrLevel="1">* * <downTime>* * <acceptableDownTime>* * <all/>* * </acceptableDownTime>* * <downTimePeriod time="600000000"/>* * </downTime>* * </Procedure>* * <Procedure attrProc="TestProcB" attrLevel="2">* * <downTime>* * <acceptableDownTime>* * <all/>* * </acceptableDownTime>* * <downTimePeriod time="600000000"/>* * </downTime>* * </Procedure>* *</InfoTag>* *File2.xml* *<?xml version="1.0" encoding="UTF-8"?>* *<InfoTag>* *<Procedure attrProc="TestProcC" attrLevel="3">* * <downTime>* * <acceptableDownTime>* * <all/>* * </acceptableDownTime>* * <downTimePeriod time="600000000"/>* * </downTime>* * </Procedure>* * <Procedure attrProc="TestProcD" attrLevel="4">* * <downTime>* * <acceptableDownTime>* * <all/>* * </acceptableDownTime>* * <downTimePeriod time="600000000"/>* * </downTime>* * </Procedure>* *</InfoTag>* I am trying to fetch an output file which looks like this: *Output.xml* *<InfoTag>* *<Procedure attrProc="1" attrLevel="### NOT UNIQUE ###">* * <downTime>* * <acceptableDownTime>* * <all/>* * </acceptableDownTime>* * <downTimePeriod time="600000000"/>* * </downTime>* * </Procedure>* * <Procedure attrProc="2" attrLevel="### NOT UNIQUE ###">* * <downTime>* * <acceptableDownTime>* * <all/>* * </acceptableDownTime>* * <downTimePeriod time="600000000"/>* * </downTime>* * </Procedure>* *<Procedure attrProc="3" attrLevel="### NOT UNIQUE ###">* * <downTime>* * <acceptableDownTime>* * <all/>* * </acceptableDownTime>* * <downTimePeriod time="600000000"/>* * </downTime>* * </Procedure>* * <Procedure attrProc="4" attrLevel="### NOT UNIQUE ###">* * <downTime>* * <acceptableDownTime>* * <all/>* * </acceptableDownTime>* * <downTimePeriod time="600000000"/>* * </downTime>* * </Procedure> * *</InfoTag>* The number of Procedure tag (<Procedure>) can be different every time. So I have to read this tag every time from each xml and then merge it sequentially. Can anyone tell me how to achieve this. How can I loop every Procedure tag and and append the attrProc attribute value in a sequential order? Thanks, BR, Varun
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
How to loop through nodes of xml through xslt varun bhatnagar <varun292006@gmail.com> - 2014-07-30 14:16 +0200
csiph-web