Xpath & namespaces, How to use namespace in xpath?

Roseanne Zhang

You need to understand how namespace and its prefix works to understand your problem.

  • All tags w/o prefix in your XML belong to the default namespace "http://www.imsproject.org/xsd/imscp_rootv1p1p2"
  • Prefix, such as "adlcp" must be defined in your xpath context before using.
  • If you're using XSLT, it must be defined there. Otherwise, you need to use namespace-uri() and local-name() functions.
  • A simple example can be found here Q. How to handle attributes with namespace in xpath?. Give it a try!