我有以下XML文档。
<case.considered>
<case.ref BVtable="yes">
<citetitle type="case" full="Lee Ting Lam v Leung Kam Ming" legtype="ord">Lee Ting Lam v Leung Kam Ming</citetitle>
<citecitation full="[1980] HKLR 657">[1980] HKLR 657</citecitation>
</case.ref>
</case.considered>
<case.considered>
<case.ref BVtable="yes">
<citetitle type="case" full="Chan Pui Ki v Leung On" legtype="ord">Chan Pui Ki v Leung On</citetitle>
<citecitation full="[1996] 2 HKLR 401, [1996] 2 HKC 565">[1996] 2 HKLR 401</citecitation>
</case.ref>
</case.considered>
<case.considered>
<case.ref BVtable="yes" annotation="considered">
<citetitle type="case" full="Sung Fuk Wah v Lam Wai Leuk" legtype="ord">Sung Fuk Wah v Lam Wai Leuk</citetitle>
<citecitation full="(unrep., HCA 3676/1994, [1995] HKLY 527)">(unrep., HCA 3676/1994)</citecitation>
</case.ref>
</case.considered>
<case.considered>
<case.ref BVtable="yes" annotation="distinguished">
<citetitle type="case" full="Blamire v South Cumbria Health Authority" legtype="ord">Blamire v South Cumbria Health Authority</citetitle>
<citecitation full="[1993] PIQR Q1">[1993] PIQR Q1</citecitation>
</case.ref>
</case.considered>
<case.considered>
<case.ref BVtable="yes" annotation="distinguished">
<citetitle type="case" full="W (A child) v Hammersmith Hospitals NHS Trust" legtype="ord">W (A child) v Hammersmith Hospitals NHS Trust</citetitle>
<citecitation full="[2002] 3 QR 5, [2002] All ER (D) 397">[2002] All ER (D) 397</citecitation>
</case.ref>
</case.considered>
以及下面的XSLT
<xsl:template match="ref.group" name="ref.group">
<xsl:if test="leg.mentioned">
<xsl:for-each select="./leg.ref">
<xsl:if test="./@considered='no'">
<div class="section-sect1">
<xsl:text>Legislation mentioned in the judgment</xsl:text>
</div>
<div class="para">
<xsl:value-of select="citetitle"/>
<xsl:text>, </xsl:text>
<xsl:for-each select="./leg.ptr.group/leg.ptr">
<xsl:value-of select="."/>
<xsl:if test="not(position() = last())">
<xsl:text disable-output-escaping="yes">, </xsl:text>
</xsl:if>
</xsl:for-each>
</div>
</xsl:if>
</xsl:for-each>
</xsl:if>
<xsl:if test="//case.considered">
<div class="section-sect1">
<xsl:text>Case cited in the judgment</xsl:text>
</div>
<xsl:apply-templates select="//case.considered" mode="x"/>
</xsl:if>
<xsl:if test="./other.mentioned">
<div class="section-sect1">
<xsl:text>Other materials mentioned in the judgment</xsl:text>
</div>
<xsl:apply-templates select="./other.mentioned"/>
</xsl:if>
<xsl:apply-templates select="//judgment"/>
</xsl:template>
<xsl:template match="case.considered" mode="x">
<div class="para">
<xsl:apply-templates select="case.ref" mode="x"/>
</div>
</xsl:template>
<xsl:template match="case.ref" mode="x">
<span class="font-style-italic">
<xsl:value-of select="./citetitle[@full]"/>
</span>
<xsl:text> </xsl:text>
<xsl:value-of select="./citecitation/@full"/>
</xsl:template>
这里我无法知道如何根据citetitle
请告诉我如何对数据进行排序。
由于
答案 0 :(得分:1)
我猜你要添加排序是 case.considered 。目前,你正在这样做
<xsl:apply-templates select="//case.considered" mode="x"/>
要进行排序,您需要将其更改为
<xsl:apply-templates select="//case.considered" mode="x">
<xsl:sort select="case.ref/citetitle" />
</xsl:apply-templates>
这假设每个 case.considered 元素只有一个 case.ref 元素。如果有多个,则在排序中仅使用第一个。