Page 1 of 1

SQF XInclude problem

Posted: Tue Jun 02, 2015 9:19 am
by Patrik
Hi,

I just made the following experiment with sqf in combination with xinclude:
main.xml:

Code: Select all

<Root xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="included.xml"/>
<Element>2</Element>
</Root>
included.xml:

Code: Select all

<Element>3</Element>
schematron with sqf:

Code: Select all


<sch:pattern>
<sch:rule context="Element[preceding-sibling::Element]">
<sch:let name="ThisValue" value="number(.)"/>
<sch:let name="PrevValue" value="number(preceding-sibling::Element[1])"/>
<sch:assert test="$ThisValue > $PrevValue" sqf:fix="AdjustThisValue AdjustPrevValue">
The value (<sch:value-of select="$ThisValue"/>) should be gerater then the previous value (<sch:value-of select="$PrevValue"/>).
</sch:assert>

<sqf:fix id="AdjustThisValue">
<sch:let name="NewValue" value="$PrevValue + 1"/>
<sqf:description>
<sqf:title>Adjust this value to <sch:value-of select="$NewValue"/></sqf:title>
</sqf:description>
<sqf:replace match="text()" select="$NewValue"/>
</sqf:fix>
<sqf:fix id="AdjustPrevValue">
<sch:let name="NewValue" value="$ThisValue - 1"/>
<sqf:description>
<sqf:title>Adjust previous value to <sch:value-of select="$NewValue"/></sqf:title>
</sqf:description>
<sqf:replace match="preceding-sibling::Element[1]/text()" select="$NewValue"/>
</sqf:fix>
</sch:rule>
</sch:pattern>
When all "Element" elements are in the same file the quickfixes work fine. But when executing the QuickFix "Adjust previous value to 1" for the file main.xml from above it is crippled to:

Code: Select all

<Root1>
<xi:include href="Included.xml"/>
<Element>2</Element>
</Root>
Regards,
Patrik

Re: SQF XInclude problem

Posted: Tue Jun 02, 2015 11:25 am
by tavy
Hi Patrik,

We do not support quick fixes in included documents. We have an issue on our issue tracker regarding this.
First we need support in oXygen to allow quick fixes to make modifications in other documents than the current on. Also, the fixes are not supported even if the error is reported in an included document. This is scheduled for the next release version.
Thank you for your feedback.

Best Regards,
Octavian

Re: SQF XInclude problem

Posted: Mon Jan 04, 2016 6:16 pm
by tavy
Hello,

Please note that the issue that you reported was fixed in oXygen 17.1.
We added support to execute Schematron Quick Fixes on documents other than the current one.
You can apply Schematron Quick Fixes over the nodes from referred documents (referred using XInclude or external entities), and you can access them as nodes in your current document.

Also, you can apply the quick fixes over other documents using the doc() function in the value of the match attribute. For example, you can add a new key in the keylist.xml file using the following operation:

Code: Select all

<sqf:add match="doc('keylist.xml')/KeyList" target="Key" node-type="element" select="Key2">
Best Regards,
Octavian