Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Is it possible to use schematron to report on Arbortext change tracking markup?
For instance, here is a fragment of my XML document that contains markup:
<atict:add user="jenmille" time="1478038337">
<onePieceOfPuzzle id="F1407047"
revision="future">
<name id="F1407045">
Credit Categories in Calculation
Processing
</name>
<p id="F1407034">
The calculation process consists
of multiple phases.
</p>
<ul id="F1411378">
<li id="F1411381">
<p id="F1471899">
If multiple performance measures match a
credit transaction, then the calculation process
creates a duplicate of the transaction for
each of the matched performance measures.
</p>
</li>
</ul>
</onePieceOfPuzzle>
</atict:add>
Here is a very generic schematron file that I use to run a completeness check against my document. I have added the atict namespace to this schematron file. The rule in this schematron should just output the name of every element.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="schematron.style" type="text/x-styler" media="editor" alternate="yes"?>
<!--Arbortext, Inc., 1988-2010, v.4002-->
<schema xmlns="http://purl.oclc.org/dsdl/schematron"
xmlns:atict="http://www.arbortext.com/namespace/atict">
<pattern id="listElementNames">
<rule context="*">
<report test=".">
local-name: <value-of select="local-name(.)"/>
</report> `
</rule>
</pattern>
</schema>
All elements in the document are output to the schematron report except the atict elements. I have tried many different ways to just get the atict elements to be recognized by the schematron rules and processor but nothing is working. I have also tried to look at the atict spec as mentioned in the online help: http://www.arbortext.com/namespace/atict/change-tracking-markup-spec.html and it is unreachable for me.
Many thanks!
Jenny
Those were the good old days! I think those arbortext.com links have been broken for about 10 years now...
Regards the Schematron, what I would suggest as a starting place is to try get it working outside of Arbortext, then bring it back in. I don't see any obvious errors in your .sch definition. One thing I wonder is if the atict:* stuff has been magically stripped by Arbortext by the time the Schematron is applied?
I think there's 2 possible things blocking you from what you want here. First, like Gareth said, it's possible the atict tags get stripped before the schematron is run. Second, I know from experience that without some changes to the schematron file and some ACL coding, elements with non-schematron namespaces won't end up in the report file. In my case I needed to add some extra stuff to the output file and wanted to define that in the schematron file. Because of that, my foreign namespace was in the schematron file while yours is in the document the schematron is applied to. So I'm not sure my fix will apply 100% to your situation. In case it helps, here's how I was able to do it:
First, change your schematron root element to look like this
<iso:schema xmlns:iso="http://purl.oclc.org/dsdl/schematron" xmlns:atict="http://www.arbortext.com/namespace/atict">
Then change all your tags to include the iso namespace, like <iso:pattern id="listElementNames">
Next, you'll need to add a compositionframeworkhook (search for it in help) using the ACL add_hook() function. add_hook() needs to be called before you run the schematron. The hook function you define should look like this:
function schematron_compose_hook($doc, $type, $where, $params[]) {
if($where != $compose::HK_CFTI_INITIAL || basename($params['stylesheet']) != 'ptc_svrl_for_xslt2.xsl') { return 0; }
$params['transformerParams'] = 'allow-foreign=true||' . $params['transformerParams'];
}
You might be able to determine whether the atict tags are getting stripped in that hook function, too. The "$doc" parameter is the id to the doc the schematron is being applied to, so you can use some ACL function calls from within that "if" block to see whether they exist in the doc at that point.
Thank you for the great suggestions. I will report back once I get a little further along.