Thanks Martin,
I want to clarify my understanding..
I can get a XmlNode which has a max id attribute value for below syntax:
XmlNode node = doc.SelectSingleNode( /Books/Book[not(@id <=
preceding-sibling::Book/@id) and not(@id <= following-sibling::Book/@id)] )
but how to implement below expression? what type will return? XmlNode or
just a value of id
/Books/Book/@id[not(. <= ../preceding-sibling::Book/@id) and not(. <=
../following-sibling::Book/@id)]
Thanks again!!!
"Martin Honnen" <ma*******@yahoo.de> ???
news:O0**************@TK2MSFTNGP05.phx.gbl ???...
beachboy wrote:
can we get the max value of element from xpath
e.g: Xpath Query Expression: /Books/Book[@id='3'] to select XMLNode
which id is "3"
Can I use Xpath to get the MAX Book id?
This XPath expression
/Books/Book[not(@id <= preceding-sibling::Book/@id) and not(@id <=
following-sibling::Book/@id)]
selects the Book element with the maximum id attribute value.
If you want to select the attribute itself then use
/Books/Book/@id[not(. <= ../preceding-sibling::Book/@id) and not(. <=
../following-sibling::Book/@id)]
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/