Schematron Quickfix - selection?

Hello oXygen friends, I need to build an ID-selector functionality into a Schematron Quickfix. That is, when an element fails validation against a Schematron (because an IDREF attrbute is missing or points to the wrong kind of element), I would like the user to be able to choose from IDs of available elements. Ideally, the Quickfix would acquire information from the elements being selected from, so the user would see not only their IDs but also certain values associated with them (to enable the correct selection). Not having found any hints in oXygen Help or in Quickfix documentation online, I suspect this isn't possible in the current version. (I'm using v19.0.) Am I wrong? If not, do any workarounds come to mind? Thanks, Wendell -- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^

Hello Wendell, This is not possible now. This functionality can be implemented either by generating quick fixes dynamically or using user entries. To generate the quick fixes dynamically you can set the "@use-for-each" attribute on the quick fix. You can generate a quick fix with a specific description for each id. There is an issue on SQF Github project that describes it: https://github.com/schematron-quickfix/sqf/issues/3. But this is not supported in current oXygen implementation. There is an issue on our issue tracker to implement it in a future version. Or you can create a quick fix that has an user entry that provides multiple values (the list of IDs that can be inserted). The user will see only one quick fix that will present a dialog with the list of IDs to be inserted. But this is also not supported in the current oXygen implementation. Best Regards, Octavian -- Octavian Nadolu <oXygen/> XML Editor http://www.oxygenxml.com On 21.08.2017 18:21, Wendell Piez wrote:
Hello oXygen friends,
I need to build an ID-selector functionality into a Schematron Quickfix. That is, when an element fails validation against a Schematron (because an IDREF attrbute is missing or points to the wrong kind of element), I would like the user to be able to choose from IDs of available elements. Ideally, the Quickfix would acquire information from the elements being selected from, so the user would see not only their IDs but also certain values associated with them (to enable the correct selection).
Not having found any hints in oXygen Help or in Quickfix documentation online, I suspect this isn't possible in the current version. (I'm using v19.0.)
Am I wrong? If not, do any workarounds come to mind?
Thanks, Wendell

Hi Wendell, You can use the content completion configuration file to control the available values for an attribute using an XSLT that will generate the values and the annotations for that attribute. For example, let's say we have a document like: <sample> <a id="aid1"><desc>ID 1 of a</desc></a> <a id="aid2"><desc>ID 2 of a</desc></a> <a id="aid3"><desc>ID 3 of a</desc></a> <b id="bid1"><desc>ID 1 of b</desc></b> <b id="bid2"><desc>ID 2 of b</desc></b> <b id="bid3"><desc>ID 3 of b</desc></b> <aref ref="aid1"/> <bref ref="bid1"/> </sample> and we want the aref/@ref to contain a/@id and not b/@id values. Then we can do this by setting up a framework for our sample document and provide a cc_config.xml file like <?xml-model href="http://www.oxygenxml.com/ns/ccfilter/config/ccConfigSchemaFilter.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oxygenxml.com/ns/ccfilter/config http://www.oxygenxml.com/ns/ccfilter/config/ccConfigSchemaFilter.xsd" xmlns="http://www.oxygenxml.com/ns/ccfilter/config"> <!-- The contributed values are obtained by executing the given XSLT --> <match elementName="aref" attributeName="ref"> <xslt href="aids.xsl" useCache="false" action="replace"/> </match> </config> with the referred aids.xsl containing <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" exclude-result-prefixes="xs xd" version="2.0"> <xsl:param name="documentSystemID"/> <xsl:template name="start"> <xsl:variable name="a" select="doc($documentSystemID)//a"/> <items action="replace"> <xsl:apply-templates select="$a"> <xsl:sort select="./@id"/> </xsl:apply-templates> </items> </xsl:template> <xsl:template match="a"> <item value="{@id}" annotation="Refer to an a element with the ID {@id} {./desc}"/> </xsl:template> </xsl:stylesheet> Then, if we provide also a CSS for visual editing, we can edit IDs in text fields and the references using drop downs. Such a CSS may look like * { display:block; margin:1em; padding:0.2em; } a {border:1px solid green;} b {border:1px solid blue;} desc {background-color:#FAFBF0;} a:before, b:before { content: oxy_local-name() " ID: " oxy_textfield( edit, '@id', columns, 40 ) } aref:before { content: "Ref to a: " oxy_combobox( edit, '@ref', editable, false ); } bref:before { content: "Ref to b: " oxy_combobox( edit, '@ref', editable, false ); } This will provide both in text mode and in author mode support for setting the correct values for aref/@ref, one of the available a/@id values. Attached you can find a project with the samples and framework already setup, open the controlledIDs.xpr project then if you edit the sample.xml file you should notice the desired behavior for the aref/@ref attribute. Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 22/08/17 11:28, Oxygen XML Editor Support (Octavian Nadolu) wrote:
Hello Wendell,
This is not possible now. This functionality can be implemented either by generating quick fixes dynamically or using user entries.
To generate the quick fixes dynamically you can set the "@use-for-each" attribute on the quick fix. You can generate a quick fix with a specific description for each id. There is an issue on SQF Github project that describes it: https://github.com/schematron-quickfix/sqf/issues/3. But this is not supported in current oXygen implementation. There is an issue on our issue tracker to implement it in a future version.
Or you can create a quick fix that has an user entry that provides multiple values (the list of IDs that can be inserted). The user will see only one quick fix that will present a dialog with the list of IDs to be inserted. But this is also not supported in the current oXygen implementation.
Best Regards, Octavian

Hi George, Octavian, Many thanks for the responses and the ideas! My project doesn't have a framework -- yet -- but it probably will (perhaps sooner rather than later) so I am very grateful. Being able to call an XSLT for content completion is indeed a very powerful technique: thanks for showing how it's done. Onward with Quickfixes - cheers, Wendell On Tue, Aug 22, 2017 at 5:28 AM, George Bina <george@oxygenxml.com> wrote:
Hi Wendell,
You can use the content completion configuration file to control the available values for an attribute using an XSLT that will generate the values and the annotations for that attribute.
For example, let's say we have a document like: <sample> <a id="aid1"><desc>ID 1 of a</desc></a> <a id="aid2"><desc>ID 2 of a</desc></a> <a id="aid3"><desc>ID 3 of a</desc></a> <b id="bid1"><desc>ID 1 of b</desc></b> <b id="bid2"><desc>ID 2 of b</desc></b> <b id="bid3"><desc>ID 3 of b</desc></b>
<aref ref="aid1"/> <bref ref="bid1"/> </sample>
and we want the aref/@ref to contain a/@id and not b/@id values. Then we can do this by setting up a framework for our sample document and provide a cc_config.xml file like
<?xml-model href="http://www.oxygenxml.com/ns/ccfilter/config/ccConfigSchemaFilter.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oxygenxml.com/ns/ccfilter/config http://www.oxygenxml.com/ns/ccfilter/config/ccConfigSchemaFilter.xsd" xmlns="http://www.oxygenxml.com/ns/ccfilter/config">
<!-- The contributed values are obtained by executing the given XSLT --> <match elementName="aref" attributeName="ref"> <xslt href="aids.xsl" useCache="false" action="replace"/> </match> </config>
with the referred aids.xsl containing
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" exclude-result-prefixes="xs xd" version="2.0"> <xsl:param name="documentSystemID"/> <xsl:template name="start"> <xsl:variable name="a" select="doc($documentSystemID)//a"/> <items action="replace"> <xsl:apply-templates select="$a"> <xsl:sort select="./@id"/> </xsl:apply-templates> </items> </xsl:template> <xsl:template match="a"> <item value="{@id}" annotation="Refer to an a element with the ID {@id} {./desc}"/> </xsl:template> </xsl:stylesheet>
Then, if we provide also a CSS for visual editing, we can edit IDs in text fields and the references using drop downs. Such a CSS may look like
* { display:block; margin:1em; padding:0.2em; }
a {border:1px solid green;} b {border:1px solid blue;}
desc {background-color:#FAFBF0;}
a:before, b:before { content: oxy_local-name() " ID: " oxy_textfield( edit, '@id', columns, 40 ) }
aref:before { content: "Ref to a: " oxy_combobox( edit, '@ref', editable, false ); }
bref:before { content: "Ref to b: " oxy_combobox( edit, '@ref', editable, false ); }
This will provide both in text mode and in author mode support for setting the correct values for aref/@ref, one of the available a/@id values. Attached you can find a project with the samples and framework already setup, open the controlledIDs.xpr project then if you edit the sample.xml file you should notice the desired behavior for the aref/@ref attribute.
Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com
On 22/08/17 11:28, Oxygen XML Editor Support (Octavian Nadolu) wrote:
Hello Wendell,
This is not possible now. This functionality can be implemented either by generating quick fixes dynamically or using user entries.
To generate the quick fixes dynamically you can set the "@use-for-each" attribute on the quick fix. You can generate a quick fix with a specific description for each id. There is an issue on SQF Github project that describes it: https://github.com/schematron-quickfix/sqf/issues/3. But this is not supported in current oXygen implementation. There is an issue on our issue tracker to implement it in a future version.
Or you can create a quick fix that has an user entry that provides multiple values (the list of IDs that can be inserted). The user will see only one quick fix that will present a dialog with the list of IDs to be inserted. But this is also not supported in the current oXygen implementation.
Best Regards, Octavian
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com https://www.oxygenxml.com/mailman/listinfo/oxygen-user
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
participants (3)
-
George Bina
-
Oxygen XML Editor Support (Octavian Nadolu)
-
Wendell Piez