Share This:


As BAO is primarily an XML manipulation tool, XPath is a primary function that will be utilised above the "Basic" functions available and the following site is a great reference to start with in learning command basics:


A list of XPath functions is available here that can be used with BAO:


XPath, XQuery, and XSLT Function Reference


However, these examples list mainly the basics and there are times where more advanced XPath statements are required especially where there are attributes used to contain information and you need to extract a specific value based on an attribute.

The following list some XPath commands to take advantage of some of the more advanced hard to find syntax to extract information from an XML document.


XPath Examples





  <Group GroupType="ASSIGNEE" GroupID="MEA-CUSTID-GRP-00001">

  <Name>SV.GP.CFS.GSC BTR Service Desk</Name>


  <Group GroupType="RESPONSIBLE" GroupID="MEA-CUSTID-GRP-00002">

  <Name>SV.GP.CFS.GSC BTR Service Desk2</Name>


  <Group GroupType="ACCOUNTABLE" GroupID="MEA-CUSTID-GRP-00003">

  <Name>SV.GP.CFS.GSC BTR Service Desk3</Name>






Extract value based on location in the XML document:






<result>SV.GP.CFS.GSC BTR Service Desk</result>






<result>SV.GP.CFS.GSC BTR Service Desk2</result>


However the above assumes that the XML is a static document and is not changing.

If you have a "dynamic" XML document, then elements and attributes may be generated as required and therefore using a static location will not provide the intended results.  Therefore we need a method to identify and extract the information based on the attribute.

XPath commands can be embedded within each other so as to provide an extended range of functions.

The following shows one method for extracting this information.



<TaskIdentifiers Number="SVR17349937">

  <AltIdentifier Type="PARTNER" Number="PARTNERTSK00005"/>

  <AltIdentifier Type="MAINTASK" Number="MAINTSK00005"/>

  <AltIdentifier Type="RELATEDTASK" Number="CHM17799732"/>





Extract information based on attribute value in the XML document (using embedded XPath):












I hope this helps with demystifying XPATH which at times can be quite complex.