fatty- / daisy-pipeline

Automatically exported from code.google.com/p/daisy-pipeline
0 stars 0 forks source link

px:fileset-load should have a 'method' option #275

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently px:fileset-load can load a document either as XML, text or binary, 
depending on its declared media-type.

The problem is that the mapping of the media-type string to a load method is 
based on heuristics (e.g. if it ends with '+xml' load as XML) and cannot be 
aware of all existing media-types.
This is an issue for instance when loading SMIL documents from a DAISY 3 
fileset, where the SMIL media type is 'application/smil' and the file is 
consequently loaded as binary.

I propose to add a new option 'method'=xml|text|binary to force the loading 
method and bypass the media type detection.

Additionally, it might be useful to have a set of utility methods is-binary() | 
is-text() | is-xml() in the media type utils. It's not critical though.

Original issue reported on code.google.com by rdeltour@gmail.com on 14 Mar 2013 at 9:46

GoogleCodeExporter commented 9 years ago
Good idea.

I can add @method to px:fileset-filter as well.

Original comment by josteinaj@gmail.com on 14 Mar 2013 at 9:50

GoogleCodeExporter commented 9 years ago
Do we have a clear use case for "give me all files from this fileset that are 
XML|binary|test" so I don't see a strong need for @method on px:fileset-filter. 

If not I'd suggest waiting for @method on px:fileset-filter, which would depend 
on the above-mentioned new functions in media-type utils and cannot be 100% 
accurate (we cannot be aware of all the media types).

Original comment by rdeltour@gmail.com on 14 Mar 2013 at 9:57

GoogleCodeExporter commented 9 years ago
Btw. did you have a specific function signature for the XSLT functions in mind?

I'm thinking they would take a <d:file/> element as a parameter and return a 
xs:boolean...

Original comment by josteinaj@gmail.com on 14 Mar 2013 at 10:00

GoogleCodeExporter commented 9 years ago
I was thinking of sth even simpler: is-binary(xs:string) return xs:boolean

Original comment by rdeltour@gmail.com on 14 Mar 2013 at 10:48

GoogleCodeExporter commented 9 years ago
Right, there's only @media-type that needs to be checked anyway. Should there 
be a 'html' method as well?

is-xml('application/xml') : true
is-xml('application/smil') : true
is-binary('application/xml') : false
is-binary('sound.wav') : true
is-binary('text/html') : false
is-xml('application/xhtml+xml') : true
is-html('application/xhtml+xml') : true
is-html('text/html') : true
is-html('text/plain') : false
is-text('text/html') : true
is-text('text/plain') : true

Original comment by josteinaj@gmail.com on 14 Mar 2013 at 10:56

GoogleCodeExporter commented 9 years ago
Btw; are "application/smil" for SMIL 1.0 and SMIL 2.0, while 
"application/smil+xml" is just for SMIL 3.0?

Original comment by josteinaj@gmail.com on 14 Mar 2013 at 11:34

GoogleCodeExporter commented 9 years ago
...they seem interchangeable: http://tools.ietf.org/html/rfc4536

Original comment by josteinaj@gmail.com on 14 Mar 2013 at 11:37

GoogleCodeExporter commented 9 years ago
right, the '+xml' mime type is the norm since 2.1:
http://www.w3.org/TR/2005/REC-SMIL2-20051213/smil-modules.html#smilModulesNSSMIL
21MimeType

Original comment by rdeltour@gmail.com on 14 Mar 2013 at 12:16

GoogleCodeExporter commented 9 years ago
Should px:mimetype-detect check the version of the SMIL-files and omit the 
'+xml' for SMIL <=2.0 ? Or is it ok to assign '+xml' to all SMIL-files?

Original comment by josteinaj@gmail.com on 14 Mar 2013 at 12:34

GoogleCodeExporter commented 9 years ago
I think it's OK, it even makes things easier.

Original comment by rdeltour@gmail.com on 14 Mar 2013 at 12:41

GoogleCodeExporter commented 9 years ago

Original comment by josteinaj@gmail.com on 18 Mar 2013 at 2:04

GoogleCodeExporter commented 9 years ago
See https://github.com/daisy-consortium/pipeline-modules-common/pull/4

Original comment by josteinaj@gmail.com on 18 Mar 2013 at 2:04