SQF XInclude problem

This should cover W3C XML Schema, Relax NG and DTD related problems.
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

SQF XInclude problem

Post 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
tavy
Posts: 388
Joined: Thu Jul 01, 2004 12:29 pm

Re: SQF XInclude problem

Post 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
tavy
Posts: 388
Joined: Thu Jul 01, 2004 12:29 pm

Re: SQF XInclude problem

Post 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
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply