我正在使用 Saxon PE 9.7,XSLT
版本 3.0。
我尝试在<w>
before之后删除空间<damage>
。我尝试了几种解决方案:normalize-space()
, translate(., ' ', '')
, even css
, white-space: nowrap
... 我还查看了如何使用 xslt 删除所有属性值中的空格?. 不幸的是,没有一个工作。
TEI
<lg>
<!-- other <l> -->
<l>
<!-- other <w> -->
<w xml:id="ktu1-3_ii_l7_ym" type="noun" lemmaRef="uga/noun.xml#ym" rendition="#nowrap">y</w><damage agent="unknown"><supplied resp="KTU" rendition="#bracketBefore #bracketAfter"><w corresp="ktu1-3_ii_l7" type="part-of-noun">m</w></supplied></damage> <!-- type="part-of-noun" because I also have type="part-of-verb", and the display is different -->
</l>
</lg>
当我damage/supplied/w
在第二个之前<w>
,它可以工作,但不是在第一个之后<w>
XSLT
<xsl:template match="lg/l[@n]">
<li>
<xsl:apply-templates/>
<sup style="font-size: 0.8em">
<a href="{@xml:id}" name="{@xml:id}" id="line"><xsl:value-of select="@n"/></a>
</sup>
</li>
</xsl:template>
<xsl:template match="lg/l[@n]/damage/supplied">
<xsl:choose>
<xsl:when test="@rendition">
<xsl:text>[</xsl:text>
<xsl:apply-templates select="./w[not(@rendition='notDisplay')]"/><xsl:text>]</xsl:text>
</xsl:when><xsl:otherwise><xsl:apply-templates select="./w[not(@rendition='notDisplay')]"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="w">
<xsl:apply-templates select="normalize-space(.)"/>
</xsl:template>
<xsl:template match="lg/l[@n]/w">
<xsl:apply-templates select=".[@type= 'noun']" mode="css"/>
<xsl:apply-templates select="normalize-space(.)"/>
</xsl:template>
在此先感谢您的友好建议。