[tei-council] @pattern/@target language

O'Donnell, Dan daniel.odonnell at uleth.ca
Sun Jun 7 19:40:12 EDT 2009


Your corrections really make me concerned about the combination of @pattern and @target. Basically, unless you want specifically to id an element by xml:id, you are going to need to put somekind of wildcard //* expression in @pattern. This means that most of our (surely not uncommon) examples of possible certainty references are going to show xslt2 syntax with root as context and only one is going to show the mixed @target/@pattern url/xpath syntax.

This *is* going to cause confusion. When I, as a naive user, look at the examples as corrected by James, I see that I usually need to use @pattern='//* to begin references meaning 'element found anywhere' with some qualification. But I can also see that I can use @target to hit a specific id value. A natural mistake might be @target='someID' @pattern='//*/someAtt

While I might think I am pointing at the very specific //*[xml:id='someID']/someAtt (someAtt on the element identified by someID), I am actually pointing at the more general //*[xml:id='someID']//*/someAtt (the someAtt attribute of any element that is or is the child of the element identified by someID).

Anyway, I'm getting less convinved that we gain anything by the mixed syntax of @target/@pattern that makes up for the potential confusion. I am convinced that adding using @pattern here is great. And I think the combo of @pattern and @locus is of the kind of significance our original xptr syntax was back in P2 or P3.

-dan
-----------
Daniel O'Donnell
University of Lethbridge
(From my mobile telephone)

--- original message ---
From: "James Cummings" <James.Cummings at oucs.ox.ac.uk>
Subject: Re: [tei-council] @pattern/@target language
Date: June 7, 2009
Time: 4:20:9 

Daniel Paul O'Donnell wrote:
> Here's my suggestion I reordered the introductory paragraphs and added 
> alternate was of getting at the example defined by #d001:
> 
> <p>The pattern attribute used in these and other examples is a powerful mechanism which can be used to indicate precision for a large number of assertions throughout an encoded document in an economical way. The value of the <att>pattern</att> attribute is an XSLT2 pattern, using the syntax defined in <ptr target="#XSLT2"/>. Optionally, <att>target</att> can be used to define the context within which <att>pattern</att> is to be evaluated. The value of <att>target</att> (if defined) is a pointer. If no value is supplied for the                   target attribute, the context for <att>pattern</att> is the document root.</p>
> <p>Some simple
> examples follow:</p>
> 
> <egXML xmlns="http://www.tei-c.org/ns/Examples">
> <certainty pattern="@resp" locus="value" degree="0.2"/>
> </egXML>
> This encoding indicates that there is only a 0.2 certainty that any
> value for the <att>resp</att> attribute is correct, wherever it
> appears in the document.</p>

"wherever it appears in the document":  Then you must give it 
pattern="//*/@resp"

> <p><egXML xmlns="http://www.tei-c.org/ns/Examples">
> <certainty pattern="@resp='#LB'" locus="value" degree="0.2"/>
> </egXML>
> This encoding indicates that there is only a 0.2 certainty that the
> value <val>#LB</val> for the <att>resp</att> attribute is correct, 
> wherever it
> appears in the document.</p>

"wherever it appears in the document": Then you must give it as 
pattern="//*/@resp='#LB'"

> <p><egXML xmlns="http://www.tei-c.org/ns/Examples">
> <certainty pattern="*[@resp='#LB']" locus="value" degree="0.2"/>
> </egXML>
> This encoding indicates that there is only a 0.2 certainty that the
> content of any element the <att>resp</att> attribute of which has the
> value <val>#LB</val> is correct, wherever it
> appears in the document.</p>

"wherever it appears in the document": Then you must give it as 
pattern="//*[@resp='#LB']




-- 
Dr James Cummings, Research Technologies Service, University of Oxford
James dot Cummings at oucs dot ox dot ac dot uk


More information about the tei-council mailing list