herolab.XPath
herolab.XPath() Function
Note: This function can only be used in a Trusted Macro
• Introduced in version 1.5.0
Returns data results based on the passed in XPath expression from the XML statblock. This is a reliable and easier way to get stat data from a character than using regular expression parsing of Text stat blocks.
Usage
herolab.XPath(XPath)
herolab.XPath(XPath, id)
Parameters
XPath
- The XPath expression to evaluate against the XML statblock.id
- The id of the token. Defaults to the Current Token.
Returns the requested data.
Example
Get various values from Hero Lab data (which is in XML).
[race = herolab.XPath('/document/public/character/race/@name')]
[alignment = herolab.XPath('/document/public/character/alignment/@name')]
[improvedInit = herolab.XPath('boolean(/document/public/character/feats/feat[starts-with(@name,"Improved Initiative")])')]
Returns:
Human Neutral Good 1