[Standards] XEP-0372 references pointing to different elements in same stanza

JC Brand lists at opkode.com
Fri Aug 13 12:00:06 UTC 2021

Hi everyone

In XEP-0372, when references are used for "mentions", there is an 
implicit assumption that the referenced text is in the <body> tag.

There are however other elements where mentions could also occur, such 
as <subject>, <reason> and <text>, and some stanzas could have multiple 
possible elements whose text might be referenced.

XEP-0372 provides an "anchor" attribute for the <reference> tag, which 
can be used to refer to other addressable entities, to handle the case 
where the reference points to something in another stanza.

I think this "anchor" attribute can also be used to disambiguate the 
references in a stanza that has multiple text-containing elements. In 
this case, instead of letting the anchor point to an XMPP URI, it would 
only point to a fragment, meaning that the fragment is inside the same 

In HTML the fragment of a URI points to an element with the same id 
attribute value as the fragment itself, but apparently this isn't a 
general requirement for URIs. In this case, for simplicity, I would 
however stick to that convention.

So, if you have a stanza with for example, both "subject" and "body" 
tags, we can have references for both, and use the "anchor" attribute as 
follows (I hope this comes out formatted properly once sent):

<message type="headline" from="school at springfield.city">
     <subject id="subject">Attention Bart Simpson</subject>
     <body id="body">Please hand in your homework before the end of the 
     <reference anchor="#subject" begin="9" end="21" type="mention"/>

I think this is an elegant solution that uses the existing mechanics, 
and the only further requirement would be to clarify in the XEP that the 
anchor attribute can be used in this way.

I'd be happy to hear your thoughts and feedback.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.jabber.org/pipermail/standards/attachments/20210813/ef3379e7/attachment.html>

More information about the Standards mailing list