snaekobbi / pipeline-mod-braille

ARCHIVED. Please don't make any new issues or pull requests in this repo.
0 stars 0 forks source link

xml-stylesheet processing instruction does not seem to work #53

Closed josteinaj closed 8 years ago

josteinaj commented 8 years ago

Some quick tests indicate that this does not work:

<?xml-stylesheet href="stylesheet.css" media="embossed"?>

Not sure how important it is though...

bertfrees commented 8 years ago

Correct. I plan to add support for it. This would be a replacement for <link/> elements in DTBook (which is illegal).

josteinaj commented 8 years ago

I thought it was illegal as well, but after checking the DTD it seems to be allowed:

http://www.daisy.org/z3986/2005/dtbook/dtbookdoc.html

<!ELEMENT link EMPTY >
<!ATTLIST link
%attrs;
charset %Charset; #IMPLIED
href %URI; #IMPLIED
hreflang %LanguageCode; #IMPLIED
type %ContentType; #IMPLIED
rel %LinkTypes; #IMPLIED
rev %LinkTypes; #IMPLIED
media %MediaDesc; #IMPLIED
>

In the DTD changelog comments it seems like <style> was allowed in an earlier DTBook version as well:

<!--HB: 2004-03-25 36: % headmisc: removed style. -->

Nota uses DTBook v1.0.0 so as long as we don't validate the input DTBook, maybe <style> elements could be supported as well (assuming it's easy to add support for it since it's used in HTML as well).

bertfrees commented 8 years ago

Oh, okay then. Still I'd like to support the processing instruction, but this makes it less urgent I guess.

Because we don't validate (yet), <style/> is already supported in DTBook.

dkager commented 8 years ago

This bit me as well after copy-catting the processing instruction from existing test data (Norwegian I believe). The approach works well, but is not as clean IMO. Of course in the long run we'd want to use the 'Default stylesheet' feature, so I guess this is a minor issue.

bertfrees commented 8 years ago

Actually I was going to remove the "default-stylesheet" option, because it doesn't really make sense to change the default behavior of the system, and to avoid confusion (see https://github.com/daisy/pipeline-mod-braille/issues/34).

Instead I might add a "stylesheet" option, which will be evaluated after the default style sheet and before any other styles defined in the document. Whether of not I add it depends on the users, whether or not defining the style sheet in the document is practical.

The approach works well, but is not as clean IMO.

@dkager Which approach are you referring to?

dkager commented 8 years ago

The approach works well, but is not as clean IMO.

@dkager Which approach are you referring to?

The <link/> approach, because it means adding something to the document's instead of merely instructing the processor to do something.

The default stylesheet option looks like a useful feature because you can process an existing document, e.g. one you use for generating digital text files, without having to alter it. But any other solution that allows the user to specify the name of a stylesheet outside of the actual DTBook file would suffice. Like a custom XSLT step or something, although I like the current implementation too. Maybe there could be a dropdown list of 'stock' stylesheets: Default, NoCaps, DoubleLineSpacing, etc.

bertfrees commented 8 years ago

OK. That's what the "stylesheet" option would be for then. (Note the slight difference in meaning between "default-stylesheet" and "stylesheet". "default-stylesheet" means changing the sheet that is always applied. "stylesheet" means specifying a sheet that is applied in addition. The "stylesheet" option would also accept URIs relative to the input context.)

A dropdown list is a possibility although it would require considerable work to implement. (But I think it should be possible after some recent changes to the DP2 framework.)

dkager commented 8 years ago

OK, the stylesheet option sounds good. This would make it possible to use the same generic input document for multiple output formats. A dropdown list isn't important, it was just an idea.

bertfrees commented 8 years ago

This should be fixed by https://github.com/daisy/pipeline-mod-braille/commit/3a08bf3517bcf85ca38610fa1919d00df3655067.