phax / ph-schematron

Java Schematron library that supports XSLT and native application
Apache License 2.0
116 stars 36 forks source link

External Doc support in schematron #161

Closed pradyumanaggarwal closed 11 months ago

pradyumanaggarwal commented 11 months ago

Does ph-schematron provide any external doc support where users can write variable values and use it inside sch files. For example :

<sch:let name="Id" value = "document('config.xml')"

If yes, then can you share any documentation on how to use this and which ph-schematron implementation can be used to do so.

Thanks

phax commented 11 months ago

Yes, that can be done and requires the ISO Schematron or SchXslt implementation - it does not work with the "pure" implementation, because document is an XSLT feature. Unfortunately I couldn't find a working example but it has been successfully used in the past

pradyumanaggarwal commented 11 months ago

Is there any documentation or anything that I can refer to on how to use external documents ?

phax commented 11 months ago

Well you should search for XSLT documentation on it. E.g. https://stackoverflow.com/questions/61149268/how-does-the-document-function-work-in-xslt might help. hth

pradyumanaggarwal commented 11 months ago

But still the question remains final ISchematronResource schemaResource = SchematronResourceSCH.fromFile(this.schematronFile);

here if we are not passing any external file, then how will that work using select="document('abc.xsml')"

Thanks anyways.

phax commented 11 months ago

I pushed an example for you that shows how to use document. Please note that the filepaths need to be adopted

phax commented 11 months ago

@pradyumanaggarwal did that solve your issues? If so, feel free to close the ticket - thanks