Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
按作者在xml结构中的不同位置进行xslt排序_Xslt_Sorting - Fatal编程技术网

按作者在xml结构中的不同位置进行xslt排序

按作者在xml结构中的不同位置进行xslt排序,xslt,sorting,Xslt,Sorting,我正在尝试使用XSLT按作者姓名对书目进行排序。但是,作者的姓氏在xml结构的不同位置出现,具体取决于文本的类型(书籍、期刊等) 以下是数据: <biblStruct type="book" xml:id="Swanson2002"> <monogr> <title>Universities, academics and the Great Schism</title> <author> <forename>

我正在尝试使用XSLT按作者姓名对书目进行排序。但是,作者的姓氏在xml结构的不同位置出现,具体取决于文本的类型(书籍、期刊等)

以下是数据:

<biblStruct type="book" xml:id="Swanson2002">
<monogr>
  <title>Universities, academics and the Great Schism</title>
  <author>
    <forename>R. N</forename>
    <surname>Swanson</surname>
  </author>
  <imprint>
    <pubPlace>Cambridge</pubPlace>
    <biblScope type="vol">12</biblScope>
    <publisher>Cambridge Univ Pr</publisher>
    <date>2002</date>
    <note type="accessed">2012-07-06 18:34:53</note>
    <note type="url">http://books.google.com/books?hl=en&amp;lr=&amp;id=9AUE425_1xYC&amp;oi=fnd&amp;pg=PR8&amp;dq=Swanson,+Univiersities+Plaoul&amp;ots=EdkhHvSExW&amp;sig=tFOJKFi2myNWhkR_Rl4XE-cQcSc</note>
  </imprint>
</monogr>
<note type="tags">
  <note type="tag">Petrus Plaoul</note>
</note>
 <idno type="ISBN">0521522269</idno>
</biblStruct>
<biblStruct type="journalArticle" xml:id="Maier1958">
<analytic>
  <title>Zu einigen Sentenzenkommentaren des XIV Jahrunderts</title>
  <author>
    <forename>A.</forename>
    <surname>Maier</surname>
  </author>
</analytic>
<monogr>
  <title>Archivum franciscanum historicum</title>
  <imprint>
    <biblScope type="vol">51</biblScope>
    <biblScope type="pp">405-409</biblScope>
    <date>1958</date>
  </imprint>
</monogr>
<note type="tags">
  <note type="tag">Hard Copy Obtained</note>
</note>
</biblStruct>
<biblStruct type="bookSection" xml:id="Kaluza1995">
<analytic>
  <title>Les débuts de l'Albertisme tardif (Paris et Cologne)</title>
  <author>
    <forename>Zenon</forename>
    <surname>Kaluza</surname>
  </author>
</analytic>
<monogr>
  <title>Albertus Magnus und der Albertismus</title>
  <imprint>
    <pubPlace>Leiden</pubPlace>
    <biblScope type="pp">207-295</biblScope>
    <publisher>Brill</publisher>
    <date>1995</date>
  </imprint>
</monogr>
</biblStruct>

在我看来,这两种情况似乎都有

<xsl:sort select=".//author/surname"/>


我会做这项工作的

您不希望使用“或”运算符,该运算符总是返回布尔结果,但如果需要,您可以使用“并集”运算符(|):


在2.0中可以缩短为

<xsl:sort select="(monogr|analytic)/author/surname"/> 

在我看来,它似乎

<xsl:sort select=".//author/surname"/>


我会做这项工作的

您不希望使用“或”运算符,该运算符总是返回布尔结果,但如果需要,您可以使用“并集”运算符(|):


在2.0中可以缩短为

<xsl:sort select="(monogr|analytic)/author/surname"/> 

<xsl:sort select="monogr/author/surname | analytic/author/surname"/> 
<xsl:sort select="(monogr|analytic)/author/surname"/>