Since few days, I try to add a link to substring w[@type='verb']
within a string.
I am working on a TEI-XML
transliteration of clay tablets, thus elements
and @type
of <w>
contained in <l>
are not always in the same order.
XSLT
version 3.0:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:template match="/">
<xsl:apply-templates select="//div1"/>
</xsl:template>
<xsl:template match="//div1">
<!-- additional content before <ul> -->
<ul>
<li>
<xsl:for-each select="descendant-or-self::lg/l[@n]">
<xsl:variable name="verb1" select="w[@type='verb']"/>
<xsl:variable name="href1" select="w[@type='verb']/@lemmaRef"/>
<xsl:variable name="single-l" select="w[@type='coo'] | w[@type='noun'] | w[@type='verb'] | w[@type='num'] | w[@type='adv'] | w[@type='adj'] | g | name"/>
<xsl:value-of select="$single-l"/>
<sup><xsl:value-of select="./@n"/></sup>
</xsl:for-each>
</li>
</ul>
</xsl:template>
I need to add a link lemmaRef
for each w[@type='verb']
.
A sample of TEI
— I removed @xml:id
from element
other than l
for this example:
<lg>
<l n="4b-5a" xml:id="ktu1-3_ii_l4b-5a">
<w type="coo">w</w><space/>
<w type="verb" lemmaRef="uga/verb.xsl#qry"><damage degree="medium" facs="definir"><supplied resp="KTU">t</supplied></damage>qry</w>
<g>.</g>
<w type="noun" lemmaRef="uga/noun.xsl#ġlm">ġlmm</w>
<lb/><w>b</w><space/>
<w type="noun" lemmaRef="uga/noun.xsl#št">št</w>
<g>.</g>
<w type="noun" lemmaRef="uga/noun.xsl#ġr">ġr</w>
<g>.</g>
</l>
</lg>
I need to display:
<ul>
<li>w <a href="uga/verb.xml#qry">tqry</a> . ġlmm št . ġr .<sup>4b-5a</sup></li>
</ul>
"tqry" is a verb contained in <l>
.
How can I do in XSLT
to be able to display <a href="{$href1}"><xsl:value-of select="$verb1"/>
. I tried replace
of $single-l
or to define a new variable of the previous XSLT
code, but it doesn't work. I have tried also with key
but I think I still have a problem of undertanding...
In advance, thank you for your kind advice.