Home : Tutorials : XML and Related Technologies


to the main page about the tutorial  THE XML REVOLUTION  -  TECHNOLOGIES FOR THE FUTURE WEB back up next

XPath examples

The following XPath expressions point to sets of nodes in the recipe collection:

"The amounts of flour being used":
//ingredient[@name="flour"]/@amount
4
0.5
3
0.25

"The ingredients of which half a cup are used":
//ingredient[@amount='0.5' and @unit='cup']/@name
grated Parmesan cheese
shredded mozzarella cheese
shortening
flour
orange juice

"The second step in preparing stock for Cailles en Sarcophages":
//ingredient[@name="stock"]/preparation/step[position()=2]/text()
When the liquid is relatively clear, add the carrots, celery, whole onion, 
bay leaf, parsley, peppercorns and salt. Reduce the heat, cover and let 
simmer at least 2 hours to make a hearty stock.

back COPYRIGHT © 2000-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH next


Home : Tutorials : XML and Related Technologies

 

Copyright© 1998-2004 All Rights Reserved. No portion of this site may be reproduced or redistributed without prior written permission from VistaEdge Technologies

All registered trademarks appearing on this site are the property of their respective owners. Java is a trademark or registered trademark of Sun Microsystems, Inc. in the United States and other countries. This site is not connected to Sun Microsystems, Inc. and is not sponsored by Sun Microsystems, Inc.