假设您已经提供了XML片段,如下所示。你的任务是编写XPath选择器来拾取名为'变形金刚'的电影的架子。
<collection shelf="Classics">
<movie title="The Enemy" shelf="A">
<type>War, Thriller</type>
<format>DVD</format>
<year>2001</year>
<rating>PG</rating>
<popularity>10</popularity>
<description>Talk about a war</description>
</movie>
<movie title="Transformers" shelf="B">
<type>Science Fiction</type>
<format>DVD</format>
<year>1980</year>
<rating>R</rating>
<popularity>7</popularity>
<description>Science Fiction</description>
</movie>
<movie title="Trigun" shelf="B">
<type>Action</type>
<format>DVD</format>
<episodes>4</episodes>
<rating>PG</rating>
<popularity>10</popularity>
<description>Quite a bit of action!</description>
</movie>
<movie title="Ishtar" shelf="A">
<type>Comedy</type>
<format>VHS</format>
<rating>PG</rating>
<popularity>2</popularity>
<description>Boring</description>
</movie>
</collection>
&#13;
答案 0 :(得分:0)
假设标题没有备用空格试试这个
//movie[@title='Transformers']/@shelf