<div dir="ltr">Dear Alex,<div><br></div><div>Cool! Not only implemented, but done so in a way I can understand! I thought I had heard that someone had done this, just forgot who!</div><div><br></div><div>I'll investigate and get back to you directly if I've got any really specific questions.</div><div><br></div><div>Many many thanks, </div><div>James</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, 29 Oct 2018 at 13:57, Alex Jitianu <<a href="mailto:alex_jitianu@sync.ro">alex_jitianu@sync.ro</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Hello,</p>
<p>Oxygen has support for configuring the content completion through
a configuration file [1]. In such a configuration file you can
specify a XSLT that will be used to extract the possible values:</p>
<p><tt><?xml-model
href=<a class="m_-1995722878669962084moz-txt-link-rfc2396E" href="http://www.oxygenxml.com/ns/ccfilter/config/ccConfigSchemaFilter.sch" target="_blank">"http://www.oxygenxml.com/ns/ccfilter/config/ccConfigSchemaFilter.sch"</a>
type="application/xml"
schematypens=<a class="m_-1995722878669962084moz-txt-link-rfc2396E" href="http://purl.oclc.org/dsdl/schematron" target="_blank">"http://purl.oclc.org/dsdl/schematron"</a>?></tt><tt><br>
</tt><tt><config
xmlns:xsi=<a class="m_-1995722878669962084moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">"http://www.w3.org/2001/XMLSchema-instance"</a></tt><tt><br>
</tt><tt>
xsi:schemaLocation=<a class="m_-1995722878669962084moz-txt-link-rfc2396E" href="http://www.oxygenxml.com/ns/ccfilter/confighttp://www.oxygenxml.com/ns/ccfilter/config/ccConfigSchemaFilter.xsd" target="_blank">"http://www.oxygenxml.com/ns/ccfilter/config
http://www.oxygenxml.com/ns/ccfilter/config/ccConfigSchemaFilter.xsd"</a></tt><tt><br>
</tt><tt>
xmlns=<a class="m_-1995722878669962084moz-txt-link-rfc2396E" href="http://www.oxygenxml.com/ns/ccfilter/config" target="_blank">"http://www.oxygenxml.com/ns/ccfilter/config"</a>></tt><tt><br>
</tt><tt><br>
</tt><tt> <!-- The contributed values are obtained by
executing the given XSLT --></tt><tt><br>
</tt><tt> <match elementName="</tt><tt><b>elementX</b></tt><tt>"
elementNS=<a class="m_-1995722878669962084moz-txt-link-rfc2396E" href="http://www.tei-c.org/ns/1.0" target="_blank">"http://www.tei-c.org/ns/1.0"</a> attributeName="</tt><tt><b>attributeY</b></tt><tt>"></tt><tt><br>
</tt><tt> <xslt href="../xsl/extractIDs.xsl"
useCache="false" action="replace"/></tt><tt><br>
</tt><tt> </match></tt><tt><br>
</tt><tt></config></tt></p>
<p>The invoked<tt> extractIDs.xsl</tt> can read those values from an
external file ( <tt>doc('taxonomy.xml')//category[@<a class="m_-1995722878669962084moz-txt-link-freetext">xml:id='occupations</a>']</tt>)
or even from the current document (if needed) by using the
parameters <b>documentSystemID </b>and <b><b>contextElementXPathExpression</b></b></p>
<p><tt><xsl:stylesheet </tt><tt><br>
</tt><tt> xmlns:xsl=<a class="m_-1995722878669962084moz-txt-link-rfc2396E" href="http://www.w3.org/1999/XSL/Transform" target="_blank">"http://www.w3.org/1999/XSL/Transform"</a></tt><tt><br>
</tt><tt> xmlns:xs=<a class="m_-1995722878669962084moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema" target="_blank">"http://www.w3.org/2001/XMLSchema"</a></tt><tt><br>
</tt><tt> xmlns:saxon=<a class="m_-1995722878669962084moz-txt-link-rfc2396E" href="http://saxon.sf.net/" target="_blank">"http://saxon.sf.net/"</a></tt><tt><br>
</tt><tt> exclude-result-prefixes="xs"</tt><tt><br>
</tt><tt> version="2.0"></tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> <xsl:param name="</tt><tt><b>documentSystemID</b></tt><tt>"
as="xs:string"></xsl:param></tt><tt><br>
</tt><tt> <xsl:param name="</tt><tt><b>contextElementXPathExpression</b></tt><tt>"
as="xs:string"></xsl:param></tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> <xsl:template name="start"></tt><tt><br>
</tt><tt> <xsl:apply-templates select="<b>doc($documentSystemID)</b>"/></tt><tt><br>
</tt><tt> </xsl:template></tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> <xsl:template match="/"></tt><tt><br>
</tt><tt> <xsl:variable name="propertyElement" </tt><tt><br>
</tt><tt>
select="saxon:eval(saxon:expression($contextElementXPathExpression,
./*))"/></tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> <b><items></b></tt><b><tt><br>
</tt></b><b><tt> <xsl:if
test="$propertyElement/@name = 'color'"></tt></b><b><tt><br>
</tt></b><b><tt> <item value='red'/></tt></b><b><tt><br>
</tt></b><b><tt> <item value='blue'/> </tt></b><b><tt><br>
</tt></b><b><tt> </xsl:if></tt></b><b><tt><br>
</tt></b><b><tt> <xsl:if
test="$propertyElement/@name = 'shape'"></tt></b><b><tt><br>
</tt></b><b><tt> <item value='rectangle'/></tt></b><b><tt><br>
</tt></b><b><tt> <item value='square'/> </tt></b><b><tt><br>
</tt></b><b><tt> </xsl:if></tt></b><b><tt><br>
</tt></b><b><tt> </items></tt></b><tt><br>
</tt><tt> </xsl:template></tt><tt><br>
</tt><tt></xsl:stylesheet></tt><br>
</p>
<p><br>
</p>
<p>I also presented this idea a few years ago at XML Prague but at
that time it was an Oxygen extension. Some time after that we
bundled this functionality into Oxygen. As a matter of fact, I
used some TEI examples when I presented the concept at XML Prague.
[2]<br>
</p>
<p>[1]
<a class="m_-1995722878669962084moz-txt-link-freetext" href="https://www.oxygenxml.com/doc/versions/20.1/ug-editor/topics/configuring-content-completion-proposals.html#configuring-content-completion-proposals" target="_blank">https://www.oxygenxml.com/doc/versions/20.1/ug-editor/topics/configuring-content-completion-proposals.html#configuring-content-completion-proposals</a></p>
<p>[2]
<a class="m_-1995722878669962084moz-txt-link-freetext" href="https://youtu.be/76I-l8Y21nc?list=PLslaBBfd4kppQ6Z-d5YUYoJydM6L78JZ1&t=356" target="_blank">https://youtu.be/76I-l8Y21nc?list=PLslaBBfd4kppQ6Z-d5YUYoJydM6L78JZ1&t=356</a><br>
</p>
<pre class="m_-1995722878669962084moz-signature" cols="72">Best regards,
Alex
--
Alex Jitianu
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
<a class="m_-1995722878669962084moz-txt-link-freetext" href="http://www.oxygenxml.com" target="_blank">http://www.oxygenxml.com</a> </pre>
<div class="m_-1995722878669962084moz-cite-prefix">On 10/28/2018 9:35 PM, James Cummings
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">Hi there,
<div><br>
</div>
<div>In TEI, as many of you know, we write our schemas in
the TEI ODD customisation language and generate schemas in
formats such as like Relax NG, etc. but my question, I
think, is really about the way oXygen interprets Relax NG
in providing its helpful dropdown menus, etc.</div>
<div><br>
</div>
<div>In oXygen when we have an attribute value that has a
data type of anyURI oXygen helpfully pops up a list of
potential values based on listing all the @<a class="m_-1995722878669962084moz-txt-link-freetext">xml:id's</a> in the
document. The problem, as I'm sure many have encountered,
is that lists all the @<a class="m_-1995722878669962084moz-txt-link-freetext">xml:id's</a> not those that might make
suitable values for this attribute. Is there a way in the
generated Relax NG to somehow specify that the values are
any of the descendant @<a class="m_-1995722878669962084moz-txt-link-freetext">xml:id's</a> from a particular XPath
within the document (or indeed another document)?</div>
<div><br>
</div>
<div>For a use-case what I'm interested in doing in TEI is,
for a particular element customise the allowed values of
the @ana attribute (which takes multiple
whitespace-separated anyURI datatype values). We often use
this attribute in TEI to point to a number of other
elements including a taxonomy of arbitrarily-deeply nested
categories in the document instance (or shared commonly
between a number of document instances.) For example:</div>
<div>===</div>
<div>
<div> <taxonomy></div>
<div> <category <a class="m_-1995722878669962084moz-txt-link-freetext">xml:id=</a>"MSmaterials"></div>
<div> <catDesc>A list of Manuscript
Materials</catDesc></div>
<div> <category <a class="m_-1995722878669962084moz-txt-link-freetext">xml:id=</a>"paper"></div>
<div> <catDesc>Paper</catDesc></div>
<div> </category></div>
<div> <category <a class="m_-1995722878669962084moz-txt-link-freetext">xml:id=</a>"parchment"></div>
<div>
<catDesc>Parchment</catDesc></div>
<div> </category></div>
<div> </category></div>
<div> <category <a class="m_-1995722878669962084moz-txt-link-freetext">xml:id=</a>"occupations"></div>
<div> <catDesc>A list of
occupations</catDesc></div>
<div> <category <a class="m_-1995722878669962084moz-txt-link-freetext">xml:id=</a>"tinker"></div>
<div> <catDesc>A tinker</catDesc></div>
<div> </category></div>
<div> <category <a class="m_-1995722878669962084moz-txt-link-freetext">xml:id=</a>"tailor"></div>
<div> <catDesc>A tailor</catDesc></div>
<div> </category></div>
<div> <category <a class="m_-1995722878669962084moz-txt-link-freetext">xml:id=</a>"soldier"></div>
<div> <catDesc>A
soldier</catDesc></div>
<div> </category></div>
<div> <category <a class="m_-1995722878669962084moz-txt-link-freetext">xml:id=</a>"spy"></div>
<div> <catDesc>A spy</catDesc></div>
<div> </category></div>
<div> </category></div>
<div> </taxonomy></div>
</div>
<div>===</div>
<div>Here we have two categories (MSmaterials and
occupations) with a variety of sub-categories, but that
could go many levels down. When adding the @ana attribute
in oXygen the drop down would give us all of
these @<a class="m_-1995722878669962084moz-txt-link-freetext">xml:ids</a> and all those elsewhere in the document. </div>
<div><br>
</div>
<div>Is there a way manually, or semi-automatically, in the
Relax NG to signal to oXygen that for elementX/@attributeY
the drop-down menu in the XML Editor should only
provide @<a class="m_-1995722878669962084moz-txt-link-freetext">xml:ids</a> from within descendants a particular
element (e.g. //category[@<a class="m_-1995722878669962084moz-txt-link-freetext">xml:id='occupations</a>']) </div>
<div><br>
</div>
<div>In the TEI ODD customisation file, I could, of course,
limit it to specific values.... and generate Relax NG from
that. We'd do that with something like the following
(embedded in an elementSpec:</div>
<div>===</div>
<div>
<div> <attDef ident="ana" mode="change"></div>
<div> <valList mode="add" type="closed"></div>
<div> <valItem ident="#tinker"></div>
<div> <desc>A tinker</desc></div>
<div> </valItem></div>
<div> <valItem ident="#tailor"></div>
<div> <desc>A tailor</desc></div>
<div> </valItem></div>
<div> <valItem ident="#soldier"></div>
<div> <desc>A soldier</desc></div>
<div> </valItem></div>
<div> <valItem ident="#spy"></div>
<div> <desc>A spy</desc></div>
<div> </valItem></div>
<div> </valList></div>
<div> </attDef></div>
</div>
<div>===</div>
<div>Which when transformed to a closed value list in Relax
NG would mean that I could choose '#tinker', '#tailor',
'#soldier', '#spy' - giving hard-coded strings that then
function as URI fragments. But of course neglects that the
attribute can take multiple values in any order. Someone
can reasonably be both a spy and soldier. </div>
<div><br>
</div>
<div>I suppose I could on regenerating the schema, have the
processing look up this <taxonomy> and pull out all
the values, and automatically hard-code them in all
possible particular orders, but that, I hope you agree,
seems silly and of course doesn't scale. Also it has the
problem of needing to regenerate the schema every time a
new category is added. I could do this with Schematron, I
suppose, i.e. stick in a Schematron rule that says for
elementX/attributeY look up the values in
doc('taxonomy.xml')//category[@<a class="m_-1995722878669962084moz-txt-link-freetext">xml:id='occuptaions</a>'], or
something. But while that might help with validation, I
don't believe oXygen will pick that up for the dropdown
menu.</div>
<div><br>
</div>
<div>I have a very vague memory of someone looking working
on an extension to oXygen which did something like this
(though I think externally from the schema). If someone
remembers the project I'm forgetting, please do let me
know. If there was a way to signal to oXygen from Relax NG
the XPath which to use to produce the dropdown list, then
I can see us adding something that would produce that
signal to TEI ODD processing, and lots of projects using
it. Is this something that is already available, feasible,
or completely ridiculous?</div>
<div><br>
</div>
<div>Thanks for any thoughts.</div>
<div><br>
</div>
<div>James Cummings</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
</div>
<br>
<fieldset class="m_-1995722878669962084mimeAttachmentHeader"></fieldset>
<br>
<pre>_______________________________________________
oXygen-user mailing list
<a class="m_-1995722878669962084moz-txt-link-abbreviated" href="mailto:oXygen-user@oxygenxml.com" target="_blank">oXygen-user@oxygenxml.com</a>
<a class="m_-1995722878669962084moz-txt-link-freetext" href="https://www.oxygenxml.com/mailman/listinfo/oxygen-user" target="_blank">https://www.oxygenxml.com/mailman/listinfo/oxygen-user</a>
</pre>
</blockquote>
<br>
</div>
_______________________________________________<br>
oXygen-user mailing list<br>
<a href="mailto:oXygen-user@oxygenxml.com" target="_blank">oXygen-user@oxygenxml.com</a><br>
<a href="https://www.oxygenxml.com/mailman/listinfo/oxygen-user" rel="noreferrer" target="_blank">https://www.oxygenxml.com/mailman/listinfo/oxygen-user</a><br>
</blockquote></div>