[4suite] get attribute value via XPath

Uche Ogbuji uche at ogbuji.net
Wed Jul 2 06:36:39 MDT 2008


re-send from July 1 a.m....

7kkvhyf02 at sneakemail.com wrote:
> How do I get the attribute value via XPath?
>
> Currently I'm using the following workaround:
>
> attr = Evaluate( '//element/@attr1', contextNode=doc )[0].nodeValue
>   

The above is perfectly legitimate, but if you're sure that in your case
you just want the string value of the attribute, use the string function:

attrval = Evaluate('string(//element/@attr1)', contextNode=doc)


-- 
Uche Ogbuji                       http://uche.ogbuji.net
Founding Partner, Zepheira        http://zepheira.com
Linked-in profile: http://www.linkedin.com/in/ucheogbuji
Articles: http://uche.ogbuji.net/tech/publications/




More information about the 4suite mailing list