Page 1 of 1

Hot links in schematron error messages

Posted: Thu Oct 19, 2017 7:22 pm
by dcramer
In my schematron message, I sometimes include hyperlinks to point the user to a source for more information about their problem:

Code: Select all

        <sch:rule context="db:book|db:part|db:section|db:chapter|db:appendix|db:preface|db:table|db:figure|db:simplesect">
            <sch:assert test="@xml:id">xml:id required on <xsl:value-of select="local-name(.)"/>. https://example.com/wiki/xmlid-attributes</sch:assert>
        </sch:rule>

Is there some markup I can add to make these links hot when they view the message in Oxygen?

Thanks,
David

Re: Hot links in schematron error messages

Posted: Thu Oct 19, 2017 7:28 pm
by dcramer
Another, similar approach would be to support some kind of help content inside the framework, such that I could add something to map certain error to certain help, then Oxygen adds a help icon or link to the message opening the help content.

A hot link is fine too, especially if it's also hot in the Errors tab. I worry that many users won't know to do Show Message. Or perhaps double clicking on a message in the Errors tab should be the same as Right-Click->Show Message.

David

Re: Hot links in schematron error messages

Posted: Fri Oct 20, 2017 8:27 am
by xephon
The right way is to use the "see" attribute on the rule element.

Re: Hot links in schematron error messages

Posted: Fri Oct 20, 2017 10:28 am
by tavy
Hello David,

If you want to add link to the Schematrom message you must specify the link in the value of the @see attribute. The attribute can be added on the report/assert element or on the rule (as "xephon" said). The links are presented as a clickable icon, both on the tooltip that is presented when you hover over an error in editor, and in the results view. For your example the Schematron rule should look like this:

Code: Select all

<sch:rule context="db:book|db:part|db:section|db:chapter|db:appendix|db:preface|db:table|db:figure|db:simplesect">
    <sch:assert test="@xml:id" see="https://example.com/wiki/xmlid-attributes.html">
    xml:id required on <xsl:value-of select="local-name(.)"/>.</sch:assert>
</sch:rule>


If you want to add some a help inside a framework you can use a catalog to redirect the links to the local help. For this you must create a catalog file, and add it to your framework using the Catalogs tab from the Document Type configuration dialog box.
For your example the catalog can look like the one below:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN" "http://www.oasis-open.org/committees/entity/release/1.1/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
    <rewriteURI uriStartString="https://example.com/wiki" rewritePrefix="doc/"/>
</catalog>


Redirects all the links to the "https://example.com/wiki", to your local "doc" folder.

You can read more about how to configure a catalog here:
https://www.oxygenxml.com/doc/versions/19.1/ug-editor/topics/dg-xml-catalogs.html
https://www.oxygenxml.com/doc/versions/19.1/ug-editor/topics/using-XML-Catalogs.html

Best Regards,
Octavian

Re: Hot links in schematron error messages

Posted: Mon Oct 23, 2017 6:54 am
by dcramer
Perfect!

Thanks,
David