(Q18) Make a list of holdings, ordered by title. For journals, include the editor, and for all other holdings, include the author.

FOR $h IN //holding
RETURN
   <holding>
      $h/title,
      IF $h/@type = "Journal"
      THEN $h/editor
      ELSE $h/author
   </holding> SORTBY (title)

XSLT equivalent to (Q18)

<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <xsl:for-each select="//holding">
      <xsl:sort select="title"/>
      <holding>
        <xsl:copy-of select="title"/>
        <xsl:choose>
          <xsl:when test="@type='Journal'">
            <xsl:copy-of select="editor"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:copy-of select="author"/>
          </xsl:otherwise>
        </xsl:choose>
      </holding>
    </xsl:for-each>
  </xsl:template>
</xsl:transform>
<<<  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15    >>>