xpath paths

Hi,

http://www.tizag.com/xmlTutorial/xpathdescendant.php

I was reading above tutorial on xpath. when to use relative path and when to use absolute path? What is the exact difference and practical use of each one?
Please advies
LVL 7
gudii9Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gertone (Geert Bormans)Information ArchitectCommented:
An absolute XPath will always render the same result, regardless of the context used,
so it forces a start from the root (simplified explanation for now!)

It is like a a windows folder:
C:\data\something

An absolute path starts with a "/" indicating the root (or document element)
I am not sure I agree with what the tutorial does
"inventory/drinl/lemonade/price" for me is relative to the document element
and it will definitely NOT work in every context

A relative path relies on a context
"drink/pop/price" will only be relevant in teh context of the inventory element
for XSLT "context" means the template of inventory (or inside a for-each visiting the different inventory)
for an XML editor such as Oxygen, "context" means a currently selected node

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gertone (Geert Bormans)Information ArchitectCommented:
By the way, I don't like your tutorial too much, it seems a bit of examples put together without a decent explanation

Advice: read this book:
http://www.dcc.fc.up.pt/~zp/aulas/pde/geral/bibliografia/XSLT.pdf

not sure the PDF is legal, but you can buy it or read it on safari
make sure you read the first edition, it is more concise and does not cover XSLT2

it is a splendid reference (I am using the second edition in my XSLT teaching classes)
Doug explains it all very well.
Your eyes will open after no more than 40 pages or so
gudii9Author Commented:
sure
gudii9Author Commented:
link says
Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

www.dcc.fc.up.pt
Apache/2.2.14 (Mandriva Linux/PREFORK-1.4mdv2010.0)

please advise
Gertone (Geert Bormans)Information ArchitectCommented:
you need a 0708/ before the pde/
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.