Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating stale paths in XProc pipelines #1832

Open
wendellpiez opened this issue Dec 11, 2023 · 9 comments
Open

Updating stale paths in XProc pipelines #1832

wendellpiez opened this issue Dec 11, 2023 · 9 comments

Comments

@wendellpiez
Copy link

Run a string search on the XProc here, for http://www.jenitennison.com/xslt/xspec/
https://github.com/xspec/xspec/blob/master/src/harnesses/harness-lib.xpl, and find three hits,

https://github.com/xspec/xspec/blob/48e934dfa89ab0da209c5057db7e07573f27da79/src/harnesses/harness-lib.xpl#L274C20-L274C59

and two others.

These work much better if they are updated, for example to ../../src/reporter/format-xspec-report.xsl in this case.

Easiest way to update and test? (I'm not sure who is working on an XProc platform for XSpec these days.) Thanks for guidance 🥬 🥕

For interest (not hardly tested):

<!-- somewhere top-level ... -->
<p:variable name="resource-path"
   select="function($p as xs:string) as xs:string { 
     if (boolean($xspec-home)) then resolve-uri($p, $xspec-home)
     else ('../..', $p) => string-join('/') }"/>

<!-- at line 133... >
<p:variable name="compiler"
   select="if ($compiler-uri) then $compiler-uri
     else $resource-path('src/compiler/compile-xslt-tests.xsl')"/>
@wendellpiez
Copy link
Author

Unrelated to this issue, but in the same file, it would be great if //p:xslt[@name='format-report'] had

<p:with-param name="inline-css" select="'true'"/>

or whatever method is deemed best to ensure the availability of CSS for HTML report results.

@wendellpiez
Copy link
Author

wendellpiez commented Dec 11, 2023

Some work in progress shows how to evade the issues reported above using pipelines calling the provided pipelines:

https://github.com/wendellpiez/metaschema-xslt/tree/issue93-xproc-for-xspec_A/support/xspec-dev

@AirQuick
Copy link
Member

AirQuick commented Dec 12, 2023

"Stale" Paths

They aren't stale; they are designed to be resolved through a catalog, including EXPath Packaging. However, I guess no XSpec users depend on it nowadays. With the upcoming major verion increment (v2 -> v3), we have an opportunity to further decouple the XProc harness and EXPath Packaging.
Probably, harness-lib.xpl should compute the default value of $xspec-home based on its own URI. Is it guaranteed that if harness-lib.xpl has <p:variable select="static-base-uri()">, XProc 1.0 will provide the URI of harness-lib.xpl? (My XProc knowledge is quite limited.)

Inline CSS

To activate inline CSS, we need to specify character maps (like xsl:output/@use-character-maps in XSLT) in p:serialization. Is this possible?

@wendellpiez
Copy link
Author

I guess if you put it in the toaster it is no longer stale. 🍞

The question of static-base-uri() is a good one and needs testing to establish definitively - I can't say off hand with certainty (although XML Calabash is surely using Saxon for this).

As to character maps in XProc 1.0 that is also an excellent question. In view of it, let's forego action for now and I can make a new Issue if I come up with a good answer. (My XProc is now better layered so that I might simply be able to do what is called for without changing the library.)

@AirQuick
Copy link
Member

AirQuick commented Dec 12, 2023

(My XProc is now better layered so that I might simply be able to do what is called for without changing the library.)

Does it correctly serialize > character in the following line of the inlined CSS?

body > h2:first-of-type {

That's where the character maps are needed.

@wendellpiez
Copy link
Author

Thanks! I looked and was unable to find that - in output it is serialized as ... something odd, i.e. confirming that there is an issue writing the character.

I can imagine workarounds such as pushing the file out from Saxon directly (which I will contemplate). And XML Calabash can potentially set cdata-section-elements in a configuration (not ideal but maybe not nothing). But ultimately the solution may be XProc 3.0.

@wendellpiez
Copy link
Author

Ah, I have found xsl:character-map[@name='fmt:disable-output-escaping'] ... explains a lot.

@wendellpiez
Copy link
Author

Okay, latest update - when I set XProc to serialize method='html' and I comment out the line mapping '>' to U+E803, XML Calabash is able to produce an honest '>' character in the HTML style.

So that is something, possibly also in an XProc 3.0 context (not there yet).

@wendellpiez
Copy link
Author

Maybe the function fmt:disable-escaping needs a switch to suppress its operation, controllable via runtime parameter?

When the conversion of characters into PUA is suppressed, in current XML Calabash, the 'html' output method is sufficient. So I have <p:serializer method='html'> and I'm getting the '>' character. Thanks for hints and help so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants