Donn wrote:
path = "/svg/g[@id='slices']/*"
Now that is just confusing... When I look in the xml viewer the layer name is in an attribute called "inkscape:label", howcome @id does the job?
Oh, oops. You're right that doesn't work. But an xpath like this gets you something appropriate and specific:
path = "/svg/g[@inkscape:groupmode='layer' and @inkscape:label='slices']/*"
And the reason why that didn't work when you tried it is xml namespaces. If you'd like me to try to give a more complete explanation I could try but it will likely be clearer if you look up "xmlns". The solution is to inform the Evaluate method of the namespace context for the document you are working with. With inkex.py we can do this simple by adding "context=self.ctx" to the call as below:
inkex.xml.xpath.Evaluate(path,self.document,context=self.ctx)
Didn't mean to mislead you the first time. I named my test layer "layer2". A very bad choice. :-)
Aaron Spike