You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CMC folks wanted to refer, from within a paragraph of prose, to one of the examples in the chapter. Turns out, though, if you just do the reasonable, expected thing (put an @xml:id on the <egXML>, and then refer to it with a <ptr>), the output looks awful. (Because the text of the pointer is created by concatenating all the text nodes in the target.) That is a Stylesheets problem (for which there is not yet an issue). BUT it begs the question “how do we normally do this?”.
The answer is, we don’t have a normal way to do this. As far as I can tell (using the XSLT below):
We use <ref> to point to <anchor> (makes sense, would be hard to generate link text from an empty element) — Note that this happens 5 times, and it is always the same anchor.
We use both <ptr> and <ref> to point to <figure> (The former 4 times; the latter twice, both the same figure.)
We use <ptr> to point to <table>.
below
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheetxmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:xs="http://www.w3.org/2001/XMLSchema"xmlns:tei="http://www.tei-c.org/ns/1.0"version="3.0">
<xsl:outputmethod="text"/>
<xsl:templatematch="/">
<xsl:text>
 </xsl:text>
<xsl:apply-templatesselect="//tei:*/@target[starts-with( normalize-space(.), '#')]"/>
</xsl:template>
<xsl:templatematch="@target">
<xsl:variablename="whatIamTargetOf"select="local-name(..)"as="xs:string"/>
<xsl:variablename="whereIpoint"select="substring( normalize-space( .), 2 )"as="xs:string"/>
<xsl:variablename="whatIpointAt"select="local-name( id( $whereIpoint ) )"as="xs:string"/>
<xsl:variablename="whichOccurence"as="xs:string">
<xsl:numberselect=".."level="single"ordinal="yes"/>
</xsl:variable>
<xsl:iftest="not( $whatIpointAt = ('div', 'specGrp', 'bibl', 'biblStruct') )">
<xsl:sequenceselect=" $whatIamTargetOf ||'/@target=' ||$whereIpoint ||' points to a ' ||local-name( id( $whereIpoint ) ) ||'; it is in section ' ||(ancestor-or-self::*[@xml:id|@ident][1]/@xml:id|ancestor-or-self::*[@xml:id|@ident][1]/@ident)[1] ||' and is the ' ||$whichOccurence ||' such.
'"/>
<!-- Note-to-self: That run-on XPath for the section selects an @xml:id preferentially over an @ident. That is not really what we want; we want whichever is closer. Not worth the effort at the moment, especially since it turns out there is only 1 that does not have in @xml:id. -->
</xsl:if>
</xsl:template>
</xsl:stylesheet>
The text was updated successfully, but these errors were encountered:
Based on the guidance that was recently added by @ebeshero to the TCW 24, Council subgroup at F2F2024 recommends using <ref> instead of <ptr>
Internal references Language like "the preceding" and "the following" should not be used to refer to specific figures, tables, and examples. Instead, be sure there is an xml:id on the object in question and link to it with ref.
The CMC folks wanted to refer, from within a paragraph of prose, to one of the examples in the chapter. Turns out, though, if you just do the reasonable, expected thing (put an
@xml:id
on the<egXML>
, and then refer to it with a<ptr>
), the output looks awful. (Because the text of the pointer is created by concatenating all the text nodes in the target.) That is a Stylesheets problem (for which there is not yet an issue). BUT it begs the question “how do we normally do this?”.The answer is, we don’t have a normal way to do this. As far as I can tell (using the XSLT below):
<ref>
to point to<anchor>
(makes sense, would be hard to generate link text from an empty element) — Note that this happens 5 times, and it is always the same anchor.<ptr>
and<ref>
to point to<figure>
(The former 4 times; the latter twice, both the same figure.)<ptr>
to point to<table>
.below
The text was updated successfully, but these errors were encountered: