mricaud / xslt-quality Goto Github PK
View Code? Open in Web Editor NEWXSLT Quality
License: Apache License 2.0
XSLT Quality
License: Apache License 2.0
Integrate @Arithmeticus evolutions from PR #23, see commit Arithmeticus@e0cc349
From @Arithmeticus on slack xml.com:
Lesson learned. If building a map for fn:transform() , as a habit put an xmlns="[target XSLT default XPath namespace]" in the appropriate xsl:map-entry, e.g.,
<xsl:map-entry key="'static-params'" xmlns="">
xsl:map
<xsl:map-entry key="xs:QName('diagnostics-on')" select="true()"/>
</xsl:map>
</xsl:map-entry>
(Heck, put it at the topmost xsl:map.) If you don't and if you're working in an XSLT file whose default namespace is bound to something else (e.g., HTML), that default NS will get attached to any unprefixed result of xs:QName() . Good chance your parameter bindings will be ignored. One more test worth adding to one's Schematron XSLT checker. (Note, the target default XPath namespace, /*/@xpath-default-namespace should not be confused with the target default namespace xmlns="...".)
Hi @mricaud I've done a pull, and I'm working on some improvements. I'm looking at the rule on granular templates, with a seemingly arbitrary value of 10. Who says that's too much or too little granularity?
With the new XSLT component for the Schematron, we let users decide themselves what threshold of granularity should be permitted. All that would be needed is to set up an XSLT file exclusively for user-controlled parameters. But where should it be put?
One could argue that it should be put at /src/main/sch/xsl/parameters/config.xsl
. That would be consistent with the resources, but not very convenient for normal users, who usually dislike going so deeply into an arbitrary directory structure.
Another argument is to put it at simply parameters.xsl
. That would allow users a way to quickly and easily change the configuration that is appropriate for their project without worrying about deep file structures. (In general, the higher up a file, and the fewer siblings, the better it is for a user to find and control what they should.) But it would mean that the main file at src/main/xsl/xslt-quality.xsl
would need to have an element with several parent steps: <xsl:import href="../../../parameters.xsl">
.
What do you think? Do you prefer one of these, or do you have a third suggestion?
Oxygen is complaining about errors with localisation messages.
We add support for french language in the documention, but not in the message or SQF title.
There must be ways to do that properly, and probably add external files for any localisation
Check that XSLT default templates are not used like:
<xsl:template match="/">
xsl:apply-template
</xsl:template>
XSpec can perform schematron and XSLT tests, this would be good to add it here for the main schematron and also for the xslt library.
This would probably involve to change the namespace, that's why it should be done before Release 1.0
Notes : use PI instead of ignore attribute, cf. https://www.linkedin.com/pulse/taking-schematron-quickfix-next-level-octavian-nadolu/?articleId=6602460611286716416
Writing:
That mean parsing the xsl as text here, something like:
<sch:let name="xslt.txt" select="unparse-text(base-uri(/))"/>
indent with spaces
No break line inside templates
Space around operators ( =, +, > etc)
As a good practice, it would be nice any XSLT used in xslty-quality is valid according to xslt-quality itself :)
As said in https://xmlcom.slack.com/archives/C011NLXE4DU/p1601148109077300 a common mistake is to forget to declare tunnel parameters.
We could add a schematron warning when a parameter is thrown as tunneled and when the same name parameter is not delcared as tunneled in another template.
https://google.github.io/styleguide/xmlstyle.html
http://blog.xml.rocks/xslt-naming-conventions
http://blog.xml.rocks/structuring-xslt-code
XLS-T 3.0 allows a transform to be run without an input document, when it contains a template named 'xsl:initial-template'.
This template gets called explicitly from outside of the stylesheet, via the processor's command line, therefore the warning, "[xslqual] Named template in unused the stylesheet", is redundant.
After @Arithmeticus PR at #19
The global XSLT-quality framewrok actually needs to be restructured
This Issue will held commits for this work leading to a 1.0.0 version
xsl-qual : have a look at comments on http://markmail.org/message/y5cunpvfpy54wqe6
Hello,
I have a problem of validation the XSLT3 files with your schematron.
In a XSLT3, I declare some variables and functions and I call them between { }. The infomations in { } are not recognized by the schematron.
The error message is as follows:
[xslqual] Stylesheet function is unused
Qian
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.