On Tue, Apr 29, 2008 at 7:11 PM, Peter Hall <[EMAIL PROTECTED]> wrote: > In XPath 1.0, an attribute is an axis, not a node, and so cannot be > used as a context node. (ie the self axis that you are attempting to > access with "." does not exist). I could be wrong on this,
Actually, I might be talking crap about that. It was a year ago that I worked on the library and, well, you know... I'm looking at the spec again now and it's quite confusing, so I'm still not completely sure. Peter > > I wonder if the test site that you mention is completely compliant. > For example certain XPath 2.0 features such as "a/(b | c)" work in > there, but are not valid in XPath 1.0, so it's possible that they > support more than is required. > > Anyway, the following will work instead: > > //*[contains(@file, '.swf')]/@file > > > Peter > > > > > On Tue, Apr 29, 2008 at 6:06 PM, Glen Pike <[EMAIL PROTECTED]> wrote: > > Hmmm, > > > > Seems my original reply did not go to the list: > > > > Here is the email again, but don't worry too much about it, as I have a > > workaround... > > > > (The sitemap snippet is also missing some <activity file="activity1.swf" > > type="SWF"/> entries too - I can't just search for "//animation/@file[...]" > > ) > > > > It's a bit of a sneaky one, but I have a workaround - I just wanted to > > flag it up... > > > > Here is the email I sent back to Pete... > > > > I am trying to find all nodes with an attribute called "file" which ends > in > > (can't do this in XPath 1.0 so contains will have to do) ".swf". > > > > Here is my XPath string; > > > > //@file[contains(., ".swf")] > > > > I am comparing the AS XPath implementation with this online testbed - > which > > is also very useful :) > > > > http://www.whitebeam.org/library/guide/TechNotes/xpathtestbed.rhtm > > > > My workaround is to pull out all nodes with an attribute called file, then > > compare the values with ".swf" myself. > > > > //@file > > > > Below is a snippet of the XML I am using... > > > > <sitemap> > > <section label="Home"> > > <intro> > > <animation file="animations/MainIntro.swf"/> > > <animation file="animations/AndyIntroDuffy.swf"/> > > <animation file="animations/duffy_intro_1.swf"/> > > <animation file="animations/duffy_intro_2.swf"/> > > <animation file="animations/duffy_intro_3.swf"/> > > </intro> > > <section label="Geography"> > > <intro> > > <animation file="animations/geog_quiz_intro.swf"/> > > </intro> > > <quiz file="geography.xml"/> > > <activity type="PDF" label="Duffy's Oceans" > > file="geo-1-duffys-oceans.pdf"/> > > <activity type="PDF" label="Duffy's Coasts" > > file="geo-2-duffys-coasts.pdf"/> > > <activity type="PDF" label="Geography Glossary" > > file="geo-glossary.pdf"/> > > </section> > > <section label="English"> > > <intro> > > <animation file="animations/english_quiz_intro.swf"/> > > </intro> > > <quiz file="english.xml"/> > > <activity type="PDF" label="A Home For Duffy" > > file="eng-1-home-for-duffy.pdf"/> > > <activity type="PDF" label="A Sad Story" > > file="eng-2-a-sad-story.pdf"/> > > <activity type="PDF" label="Duffy's Day" > > file="eng-3-duffys-day.pdf"/> > > <activity type="PDF" label="Do The Duffy Rap" > > file="eng-4-duffy-rap.pdf"/> > > <activity type="PDF" label="English Glossary" > > file="eng-glossary.pdf"/> > > </section> > > </section> > > <sitemap> > > > > > > -- > > > > Glen Pike > > 01326 218440 > > www.glenpike.co.uk <http://www.glenpike.co.uk> > > > > _______________________________________________ > > Flashcoders mailing list > > [email protected] > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

