[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Find inconsistencies: Perl or XSLT?
Dear all, I need to process some files and I know how to do it in Perl, but as has happened to be the case in the past with other stuff, perhaps there's a (objectively) simpler or more efficient way to do it with XSLT. I have a file like this <unit id="1"> <source>blabla</source> <target>plapla</source> </unit> <unit id="2"> <source>bleble</source> <target>pleple</source> </unit> <unit id="3"> <source>bloblo</source> <target>ploplo</source> </unit> <unit id="4"> <source>blabla</source> <target>plapla</source> </unit> <unit id="5"> <source>bleble</source> <target>lolailo</source> </unit> I think the example is illustrative enough. The target element contains the translation of the source element, and one same element must always be translated in the same way, but sometimes it's not. So what I'd to do is find two or more units with the same source but with different target (like 2 and 5 in the example, but unlike 1 and 4). In Perl I would use a XML module (or not) and put the source elements in the keys of a hash and the target elements in their corresponding values. When assigning a new key-value pair, if the key already exists, I compare the values. If they are equal, they pass, else they are flagged and included in the report. The report in this case would be something like: The following inconsitencies have been found 2: bleble -> pleple 5: bleble -> lolailo Is it possible to do this in XSLT? Is it more efficient that doing it in Perl as I was planning to? I knowledge of XSLT is very limited and I can't see beyond transforming a XML file into another XML file. Thanks a lot for your opinion. Manuel
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|