usnistgov / oscal-tools

Tools for the OSCAL project
https://pages.nist.gov/oscal-tools/
34 stars 17 forks source link

Documented, Minimally Requied Saxon HE Version for XSLT Utilities Library #26

Closed xee5ch closed 2 years ago

xee5ch commented 2 years ago

FYI, testing some of these utilities with the current documented versions of Saxon HE (Java) for OSCAL deployments in the official CI/CD pipeline, currently the 9.9.x branch, will not work. It relies on XSLT 3.0 support for higher order functions, and/or cannot find Q{http://www.w3.org/2005/xpath-functions}random-number-generator(). Saxon does support this in the 10.x branch series of code, as tested with Saxon 10.6.

$ java -cp ~/.m2/repository/net/sf/saxon/Saxon-HE/9.9.1-3/Saxon-HE-9.9.1-3.jar net.sf.saxon.Transform -s:/my/code/oscal-tools/xslt/lib/uuid/random-util.xsl -xsl:/my/code/oscal-tools/xslt/lib/uuid/random-util.xsl
Static error near {...andom-number-generator($see...} at char 32 in expression in xsl:sequence/@select on line 55 column 97 of random-util.xsl:
  XPST0017: Cannot find a 1-argument function named
  Q{http://www.w3.org/2005/xpath-functions}random-number-generator(). Higher-order functions
  are not available in this Configuration
Static error near {...andom-number-generator($see...} at char 34 in expression in xsl:sequence/@select on line 70 column 99 of random-util.xsl:
  XPST0017: Cannot find a 1-argument function named
  Q{http://www.w3.org/2005/xpath-functions}random-number-generator(). Higher-order functions
  are not available in this Configuration
Errors were reported during stylesheet compilation

This is not explicitly documented anywhere in this repository, but it might be worth documenting here (as the error message does not make it obvious this is a tooling versioning issue) or maybe pertains to pending Saxon 10 upgrade work for relevant OSCAL pipelines and tools in usnistgov/OSCAL/#1035.

Here, after upgrade to 10.x.x, it works. FYI/FYE

$ java -cp ~/.m2/repository/net/sf/saxon/Saxon-HE/10.6/Saxon-HE-10.6.jar net.sf.saxon.Transform -s:/my/code/oscal-tools/xslt/lib/uuid/random-util.xsl -xsl:/my/code/oscal-tools/xslt/lib/uuid/random-util.xsl
<?xml version="1.0" encoding="UTF-8"?>
<randomness>
   <now>8cf17ac5-6f1b-4010-bd8f-deb37cb25748</now>
   <germ>9592e8d6-d01e-4261-9fe6-4e210efbb67e</germ>
   <a>759e95b4-6f94-4589-ad7b-cd33a79ea22a</a>
   <a>759e95b4-6f94-4589-ad7b-cd33a79ea22a</a>
   <b>2425f05b-a969-4615-a2e7-8bf0cb54aafb</b>
   <ten>
      <uuid>95836cf3-4f16-4fee-b65b-22ce1c2f56ef</uuid>
      <uuid>3a99d475-8b48-4971-bf4e-03bcb95fb0f1</uuid>
      <uuid>400ae2b0-9d77-4b2c-a1cc-6f59613a179a</uuid>
      <uuid>c477376b-8d31-4751-9320-21b73885d235</uuid>
      <uuid>1deacba9-d4fd-493e-9e70-55cdd6034cf0</uuid>
      <uuid>89587bcd-c19a-48c0-9e29-a005a1c244af</uuid>
      <uuid>360e284b-3e69-4e92-ac12-8751a09253c4</uuid>
      <uuid>82d46536-e133-4b70-ad53-a183fd11a4d0</uuid>
      <uuid>962947e0-b3c9-426c-9886-5083982976df</uuid>
      <uuid>e20209a1-6ec2-466f-9063-e7aca01dca2a</uuid>
   </ten>
</randomness>
wendellpiez commented 2 years ago

@xee5ch sorry I didn't see this sooner. This is a docs issue is it not?

xee5ch commented 2 years ago

@xee5ch sorry I didn't see this sooner. This is a docs issue is it not?

Yes, I believe it is just a docs issue.

I can draft a quick PR this weekend and send it back to you, @wendellpiez.

david-waltermire commented 2 years ago

This relates to usnistgov/OSCAL#1035. We should figure out how to keep the Saxon version used in sync across all the related repos.

wendellpiez commented 2 years ago

@aj-stein-nist would you kindly look at that commit and tell me whether it addresses the Issue as I hope?

aj-stein-nist commented 2 years ago

@aj-stein-nist would you kindly look at that commit and tell me whether it addresses the Issue as I hope?

Just checked it out, looks good to me.