schematron-quickfix / sqf

Schematron Quick Fixes
25 stars 6 forks source link

Create new files #15

Open PStellmann opened 8 years ago

PStellmann commented 8 years ago

There are some use cases that involve creating new files:

It is already possible to do this with XSLT code and xslt:result-document. But it needs to be part of an sqf command not directly related to this file. So the creation of a seperate file is somewhat hidden. I'd prefer somoething like this:

<sqf:add match="sqf:new-doc($newUrl)">
  [...]
</sqf:add>

The function sqf:new-doc (or sqf:create-doc or something like that) is only available within sqf:add and expects as parameter a sequence of urls (or only a single one).

It will cause an empty file being generated, so that with the sqf:add instruction the content can be specified.

In oXygen the new file will not directly be generated in the file system but only opened in the editor so the user can save it manually - just like the behavior with a seperate file that was modified.

nkutsche commented 6 years ago

Hi Patrik,

sorry for the late response to this issue!

I'm not sure, if this issue is worth to introduce new structure components for this.

As you said, you can handle this with xsl:result-document. The issue you described with this solution is the same as you have it already in XSLT it self, isn't it?

Anyway, if we say, we need a SQF-build-in solution for this I would prefer to introduce a new node-type document-node instead of a function:

<sqf:add match="." node-type="document-node" target="{resolve-uri('new-document.xml')}">
   [ content of the new document ]
</sqf:add>

The target could be used for the URL. The content or the select attribute defines the content of the new document.

But lets see, what other think about this.

Best Regards, Nico