I'm working with poetry and I want to give to every verse an own ID that mixes the number of the poem and the number of the verse.
Header:
<?xml version="1.0" encoding ="UTF-8" standalone ="no" ?>
<TEI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<teiHeader>
<fileDesc>
<titleStmt>
<title n="013">13</title>
Verses:
<lg>
<l n="01"></l>
</lg>
I want to create an xml:id attribute for <l>
like p013-v01 (poem 13, from n@title; verse 1 from n@l). Is there any way to do it automatically for every single line?
The purpose of this is to compare versions and editions of the same poem. I was told to do this, but to be honest I'm not sure of the utility of this xml:id attribute. I hope you can help me. Thanks!
<xsl:template match="l">
<xsl:variable name="id-num" select="concat('p', ancestor::TEI/descendant::title/@n, '-v', ./@n)"/>
<l id="{$id-num}">
<xsl:attribute name="n"><xsl:value-of select="@n"/></xsl:attribute>
<xsl:apply-templates/>
</l>
</xsl:template>
The id-value is the result of a concatenation of literal text strings and two attribute values.