xslt - xml hierarchy/xsl processing with tei:note -
i have hope symptom of ignorance , not impossible problem, can't life of me make work.
i putting footnotes using tei namespace xml, , relevant data packaged follows:
<surface xml:id="eets.t.29"> <label>verse 29</label> <graphic url="/images/img_0479.jpg"/> <zone> <line> <orig><hi>n</hi>ow in <damage>th</damage>e name of oure lord ihesus</orig> </line> <line> <orig>of right hool herte <ex>&</ex> in our<ex>e</ex> <note place="bottom" anchored="true" xml:id="explanatory">although “r” on painted panels of chapel consistently written otiose mark when concludes word, mark here rendered more heavily , dot indicating suspension above r. rendering “oure” linguistic outlier area based on electronic <emph rend="italic">linguistic atlas of late medieval english</emph>’s linguistic profiles “oure,” “our,” , “oure.” see elalme's <ref target="http://archive.ling.ed.ac.uk/ihd/elalme_scripts/mapping/user-defined_maps.html" >user defined maps</ref> more information. unfortunately current online version not allow direct linking between static dotmaps , linguistic profiles.</note> best entent</orig> </line> <line> <orig>our<ex>e</ex> lyf reme<ex>m</ex>bryng froward , vicious</orig> </line> <line> <orig>ay contrarye comaundement</orig> </line> <line> <orig>of crist ih<ex>es</ex>u wyth avisement</orig> </line> <line> <orig>the lord beseching <gap quantity="2" unit="chars" reason="illegible" /><note place="bottom" anchored="true" xml:id="informational">trapp suggests "of" here, fits space in way maccracken's "in thyn" not, not seem fit admittedly paltry remnants of text. "in" seems word here, text damaged definitively state case.</note> <damage>mercy , pete</damage></orig> </line> <line> <orig>our<ex>e</ex> youthe <ex>&</ex> age have <damage>myspent</damage></orig> </line> <line> <orig>wyt<damage>h t</damage>h<damage>is woor</damage>d <damage>mercy knelyng</damage> on oure kne<note place="bottom" anchored="true" xml:id="informational">this change occurs in clopton verses.</note></orig> </line> </zone> </surface>
because new portion of namespace, can't use standard stylesheets , have written following template number notes within displayed block of text:
<xsl:template match="tei:note"> <xsl:variable name="num"> <xsl:number count="tei:note" level="any" from="/tei:tei/tei:sourcedoc/tei:surfacegrp/tei:surface"/> </xsl:variable> <xsl:variable name="panel_name"> <xsl:value-of select="concat(../../../../@xml:id,$num)"/> </xsl:variable> <xsl:choose> <xsl:when test="@xml:id ='explanatory'"> <span class="explanatory"><sup><a><xsl:attribute name="href"><xsl:value-of select="concat('#fn',$num)"/></xsl:attribute><xsl:attribute name="id"><xsl:value-of select="$panel_name"/></xsl:attribute><font size="-1"><xsl:value-of select="$num"/></font></a></sup></span> </xsl:when> <xsl:when test="@xml:id ='informational'"> <span class="informational"><sup><a><xsl:attribute name="href"><xsl:value-of select="concat('#fn',$num)"/></xsl:attribute><xsl:attribute name="id"><xsl:value-of select="$panel_name"/></xsl:attribute><font size="-1"><xsl:value-of select="$num"/></font></a></sup></span> </xsl:when> <xsl:otherwise/> </xsl:choose> </xsl:template>
my issue, however, following set of templates, attempts display body of notes @ bottom of page, appropriately numbered:
<xsl:template name="makenotes"> <xsl:variable name="num" select="count(.//tei:note)"/> <xsl:variable name="panel_name"> <xsl:value-of select="concat(@xml:id,$num)"/> </xsl:variable> <div class="notes"> <div class="noteheading">notes</div> <xsl:call-template name="loop"> <xsl:with-param name="i" select="number(1)"/> <xsl:with-param name="max" select="$num"/> </xsl:call-template> </div> </xsl:template> <xsl:template name="loop"> <!--recursive loop until done--> <xsl:param name="i"/> <xsl:param name="max"/> <xsl:for-each select=".//tei:orig"> <xsl:if test="tei:note"> <xsl:if test="$i <= $max"> <!-- repeated content here --> <!-- use value-of loop index --> <div class ="note"><span class="notelabel"><xsl:attribute name="id"><xsl:value-of select="concat('fn',$i)"/></xsl:attribute><xsl:value-of select="$i"></xsl:value-of>.</span><div class="notebody"><xsl:value-of select="tei:note"/></div></div> <xsl:call-template name="loop"> <xsl:with-param name="i" select="$i + 1"/> <xsl:with-param name="max" select="$max"/> </xsl:call-template> </xsl:if> </xsl:if> </xsl:for-each>
i can either format code display numbers through modification of code have in tei:note template, or can format code display notes, have here. need able display both note , numbering, , understand reason why it's not working tei:note
appears once in heirarchy of each line. know how in procedural language, since xsl functional i'm stumped , none of methods i've seen suggested (using count()
, <xsl:number>
, etc) work.
the current output have follows:
<div class="note"><span class="notelabel" id="fn1">1.</span> <div class="notebody">although "r" on painted panels of chapel consistently written otiose mark when concludes word, mark here rendered more heavily , dot indicating suspension above r. rendering "oure" linguistic outlier area based on electronic linguistic atlas of late medieval english's linguistic profiles "oure," "our," , "oure." see elalme's user defined maps more information. unfortunately current online version not allow direct linking between static dotmaps , linguistic profiles.</div> </div> <div class="note"><span class="notelabel" id="fn1">1.</span> <div class="notebody">trapp suggests "of" here, fits space in way maccracken's "in thyn" not, not seem fit admittedly paltry remnants of text. "in" seems word here, text damaged definitively state case.</div> </div> <div class="note"><span class="notelabel" id="fn1">1.</span> <div class="notebody">this change occurs in clopton verses.</div> </div>
what need results indicate following:
<div class="note"><span class="notelabel" id="fn1">1.</span> <div class="notebody">although "r" on painted panels of chapel consistently written otiose mark when concludes word, mark here rendered more heavily , dot indicating suspension above r. rendering "oure" linguistic outlier area based on electronic linguistic atlas of late medieval english's linguistic profiles "oure," "our," , "oure." see elalme's user defined maps more information. unfortunately current online version not allow direct linking between static dotmaps , linguistic profiles.</div> </div> <div class="note"><span class="notelabel" id="fn2">2.</span> <div class="notebody">trapp suggests "of" here, fits space in way maccracken's "in thyn" not, not seem fit admittedly paltry remnants of text. "in" seems word here, text damaged definitively state case.</div> </div> <div class="note"><span class="notelabel" id="fn3">3.</span> <div class="notebody">this change occurs in clopton verses.</div> </div>
i think need code follows (you need adapt templates match elements in namespace sample not show namespace have worked without one):
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="html" indent="yes"/> <xsl:template match="surface"> <xsl:apply-templates select=".//orig[note]" mode="list"/> </xsl:template> <xsl:template match="orig" mode="list"> <div class ="note"><span class="notelabel" id="fn{position()}"><xsl:value-of select="position()"></xsl:value-of>.</span><div class="notebody"><xsl:value-of select="note"/></div></div> </xsl:template> </xsl:stylesheet>
that transforms input sample have posted result
<div class="note"><span class="notelabel" id="fn1">1.</span><div class="notebody">although “r” on painted panels of chapel consistently written otiose mark when concludes word, mark here rendered more heavily , dot indicating suspension above r. rendering “oure” linguistic outlier area based on electronic linguistic atlas of late medieval english’s linguistic profiles “oure,” “our,” , “oure.” see elalme's user defined maps more information. unfortunately current online version not allow direct linking between static dotmaps , linguistic profiles. </div> </div> <div class="note"><span class="notelabel" id="fn2">2.</span><div class="notebody">trapp suggests "of" here, fits space in way maccracken's "in thyn" not, not seem fit admittedly paltry remnants of text. "in" seems word here, text damaged definitively state case. </div> </div> <div class="note"><span class="notelabel" id="fn3">3.</span><div class="notebody">this change occurs in clopton verses. </div> </div>
that suggestion xslt part, if understand question correctly. target format seems html wonder why don't use ordered list , list items number items.
Comments
Post a Comment