TEIC / Stylesheets

TEI XSL Stylesheets
228 stars 123 forks source link

upgrade to 3.0 #639

Closed sydb closed 7 months ago

sydb commented 8 months ago

We floated the idea of upgrading to XSLT 3.0 in Stylesheets/ at yesterday’s meeting. Some were in favor of doing so incrementally, on an as-needed basis. While I am not against that idea, I am mildly in favor of all-at-once, perhaps in large part because I am really curious about what happens if we change them all at once. So I investigated. I checked out a fresh copy of the repo (so there is no release/ directory, and no cruft from previous work I may have done locally), and counted.[1] We have

I then issued

$ xmlstarlet ed -P -L -N l="http://www.w3.org/1999/XSL/Transform" --update "/l:*/@version[.='2.0']" -v "3.0" $(find . -name '*.xslt' -o -name '*.xsl')

to change every 2.0 to 3.0, and re-counted:

Yay! I then went into the docker, and using that Stylesheets/ dir ran make test and make test2P; all tests passed (after I issued export LC_ALL=C.UTF-8; export LANG=C.UTF-8 per @joeytakeda’s suggestion on Slack). Then, using the current dev branch of TEI, I built the Guidelines (still in the docker) with make clean validate html-web test exemplars teiwebsiteguidelines pdf epub twice — once using default en, once with OTHERLANGS set to "fr". That failed on the epub target for both languages en and fr. That is, it successfully built clean (duh!), validate, html-web, test, exemplars, teiwebsiteguidelines, and pdf before it died on epub. It died with “Key 'ATTCLASSES' has not been defined; SystemID: file:/usr/share/xml/tei/stylesheet/common/common_tagdocs.xsl; Line#: 2794; Column#: 4”, which is the exact same error I get in with the normal (dev branch) Stylesheets/!

My take away from this experiment is that

  1. We (read @peterstadler and @hcayless) need to fix the docker $LC_ALL and $LANG environment variables.
  2. We need to fix the epub processing.
  3. It is quite reasonable to convert all our 2.0 stylesheets to 3.0.[2]
  4. We need to check the 7 stylesheets that are 1.0, too.

Notes [1] I looked at the /xsl:stylesheet/@version | /xsl:transform/@version attribute (because we do have a couple files that use <xsl:transform>) of all files named .xslt or .xsl. [2] Worth noting that, although it was very fast & easy for testing, we cannot use that lovely xmlstarlet command to do the actual conversion to 3.0. Despite the -P switch (for “preserve whitespace nodes”), that command makes the files really ugly. (Yes, it preserves whitespace nodes, but there is lots of useful make-it-readable whitespace in start tags, and those whitespace characters are not nodes, and are not part of the tree the command is operating on, so they get lost.)