[tei-council] Prefacing ids with "tei_"

Martin Holmes mholmes at uvic.ca
Mon Apr 23 14:48:15 EDT 2012


I'm planning to make a significant number of changes to Sebastian's 
stylesheets to implement our decision to preface all ids in the web 
output with "tei_", in an effort to avoid the problems caused by AdBlock 
Plus. Before I do, having looked at the code, there are a couple of 
things I wanted to get some feedback on:

1. Generated ids. There are some places in which ids in the output are 
generated using the XPath generate-id() function:

	<xsl:call-template name="makeAnchor">
             <xsl:with-param name="name">
               <xsl:value-of select="generate-id()"/>
             </xsl:with-param>
           </xsl:call-template>

These result in ids that look like random sequences of characters. Do we 
need to preface these with "tei_"? My instinct says yes -- after all, 
such a random sequence is perfectly likely to end up with content which 
might trigger an AdBlock filter, so we might as well protect it in the 
normal way.

2. @n attributes. There's one place where the @n attribute can be used 
to create an id attribute in the output (in textstructure.xsl, code 
below). Should this also be prefaced by "tei_"? I'm not sure about this, 
because depending on the contents of the @n, the result might be 
puzzling. On the other hand, I don't think that @n can be relied upon to 
work as an id attribute anyway, can it?

<xsl:variable name="identifier">
          <xsl:text>App</xsl:text>
          <xsl:choose>
	   <xsl:when test="@xml:id">
	     <xsl:value-of select="@xml:id"/>
	   </xsl:when>
	   <xsl:when test="@n">
	     <xsl:value-of select="@n"/>
	   </xsl:when>
	   <xsl:otherwise>
	     <xsl:number count="tei:app" level="any"/>
	   </xsl:otherwise>
          </xsl:choose>
       </xsl:variable>

       <xsl:choose>
        <xsl:when test="$footnoteFile='true'">
	 <a class="notelink" href="{$masterFile}-notes.html#{$identifier}">
	   <sup>
	     <xsl:call-template name="appN"/>
	   </sup>
	 </a>
        </xsl:when>
        <xsl:otherwise>
	 <a class="notelink" href="#{$identifier}">
	   <sup>
	     <xsl:call-template name="appN"/>
	   </sup>
	 </a>
        </xsl:otherwise>
       </xsl:choose>

Cheers,
Martin
-- 
Martin Holmes
University of Victoria Humanities Computing and Media Centre
(mholmes at uvic.ca)


More information about the tei-council mailing list