I think since it's all working, I'll stick with BASH and avoid having to learn a completely different scripting platform. I also don't know jack about XPath and XSLT. wink

Which brings me to one additional problem.

xmlstarlet is definitely handy, but I can't seem to figure out how to easily extract particular pieces of information. Here's a sample of the originating XML (somewhat formatted):

Quote:

<?xml version="1.0" encoding="utf-8"?>
<records date="Tue, 13 Jan 2009 00:51:04 -0800">
<movieinfo id="2898">
<info>
<title>12</title>
<runtime>2:00</runtime>
<rating>PG-13</rating>
<studio>Sony Pictures Classics</studio>
<postdate>2008-11-04</postdate>
<releasedate>2009-03-04</releasedate>
<copyright>© Copyright 2009 Sony Pictures Classics</copyright>
<director>Nikita Mikhalkov</director>
<description>12 characters. 12 truths. The story of 12 jurors discussing a verdict to pass on an 18 year old Chechen boy whether he is guilty of 1st degree murder of his step-father — an officer of the Russian army. The film thinks aloud about today;s life, about the need to hear the next of kin and help that person before its too late. The action of the picture unveils in one room — a gym adjusted for jury deliberations.</description>
</info>
<cast>
<name>Sergei Makovetsky</name>
<name>Nikita Mikhalkov</name>
</cast>
<genre>
<name>Drama</name>
<name>Foreign</name>
</genre>
<poster>
<location>http://images.apple.com/moviesxml/s/sony/posters/12_l200811041428.jpg</location>
<xlarge>http://images.apple.com/moviesxml/s/sony/posters/12_xl200811041428.jpg</xlarge>
</poster>
<preview>
<large filesize="55098535">http://movies.apple.com/movies/sony/12/12_a720p.mov</large>
</preview>
</movieinfo>
<movieinfo id="2904">
<info>
<title>Angels & Demons</title>
<runtime>1:10</runtime>
<rating>Not yet rated</rating>
<studio>Sony Pictures</studio>
<postdate>2008-11-06</postdate>
<releasedate>2009-05-15</releasedate>
<copyright>© Copyright 2009 Sony Pictures</copyright>
<director>Ron Howard</director>
<description>The team behind the global phenomenon The Da Vinci Code returns for the highly anticipated Angels & Demons, based upon the bestselling novel by Dan Brown. Tom Hanks reprises his role as Harvard religious expert Robert Langdon, who once again finds that forces with ancient roots are willing to stop at nothing, even murder, to advance their goals. Ron Howard again directs the film, which is produced by Brian Grazer, Ron Howard, and John Calley. The screenplay is by Akiva Goldsman and David Koepp. When Langdon discovers evidence of the resurgence of an ancient secret brotherhood known as the Illuminati - the most powerful underground organization in history - he also faces a deadly threat to the existence of the secret organization’s most despised enemy: the Catholic Church. When Langdon learns that the clock is ticking on an unstoppable Illuminati time bomb, he jets to Rome, where he joins forces with Vittoria Vetra, a beautiful and enigmatic Italian scientist. Embarking on a nonstop, action-packed hunt through sealed crypts, dangerous catacombs, deserted cathedrals, and even to the heart of the most secretive vault on earth, Langdon and Vetra will follow a 400-year-old trail of ancient symbols that mark the Vatican’s only hope for survival. </description>
</info>
<cast>
<name>Tom Hanks</name>
<name>Ewan McGregor</name>
<name>Ayelet Zurer</name>
<name>Stellan Skarsgård</name>
<name>Pierfrancesco Favino</name>
</cast>
<genre>
<name>Drama</name>
<name>Thriller</name>
</genre>
<poster>
<location>http://images.apple.com/moviesxml/s/sony_pictures/posters/angelsdemons_l200811061144.jpg</location>
<xlarge>http://images.apple.com/moviesxml/s/sony_pictures/posters/angelsdemons_xl200811061144.jpg</xlarge>
</poster>
<preview>
<large filesize="32237184">http://movies.apple.com/movies/sony_pictures/angelsanddemons/angelsanddemons-tlr1_a720p.mov</large>
</preview>
</movieinfo>
</records>



As you can see I've shown the sample using only two movies to keep it short.

What I'd like to do is extract a single movie and throw it into its own XML file. The output would look pretty much as above except containing only one specific movie. However, I also want to preserve the "records" every time I do this.

I've already played around with some extraction and can handily extract all movies or specific elements/attributes of all movies, but I need to target in on one at a time either by matching on their ID or by specifying an integer corresponding to the nth movie (I can figure out how to get a total count as well as keep a running total in the script to reference the "current" movie)
_________________________
Bruno
Twisted Melon : Fine Mac OS Software