这是一个XML.......
<Book id="isbn-0-671-21280-X">
<Title>How to Read a Book</Title>
<Subtitle>The Classic Guide to Intelligent Reading</Subtitle>
<Author>Mortimer J. Adler</Author>
<Author>Charles Van Doren</Author>
<Date>1940</Date>
<Publisher>Simon & Schuster</Publisher>
</Book>
我想获得属性的id
长度Book
我写:
string-length(//Book/@id)
还有一个:
//Book/string-length(@id)
两者都有效,但我怀疑第二种方法是否完全正确。