G-Node / python-odml

odML libraries
http://g-node.github.io/python-odml/
BSD 4-Clause "Original" or "Old" License
24 stars 30 forks source link

Use inline style for rendering #331

Closed ghost closed 4 years ago

ghost commented 4 years ago

Dear Sie/Madame:

I am an employee at INM-6, Forschungszentrum Jülich. We use odml schema for data description.

I am writing to you to propose a method for rendering locally stored odml file, with inline style.

The problem is, locally stored odml files can not be rendered properly any more in new version of common browser softwares with the external odml.xsl. However they can be rendered using inline style. I tested it and it works fine.

The inline style sheet integration can be done like:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="#stylesheet"?>
<!DOCTYPE odML
[
    <!ATTLIST xsl:stylesheet
    id ID #REQUIRED>
]>
<odML version="1">
  <xsl:stylesheet id="stylesheet"
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
    <xsl:template match="odML">
      <xsl:variable name="repository" select="repository"/>
      <html>
        <!-- <head> //-->
          <style type="text/css">
            Here style sheets
          </style>
        <!-- </head> //-->
        <body>
          Here HTML body
        </body>
      </html>
    </xsl:template>
Followed by odml tags

This kind of inline styled odml files work directly in Firefox. For Chrome "application/xml" must be registered in Mime-type database for .odml extension.

Best regards, Sun

mpsonntag commented 4 years ago

Hi sun, thanks a lot for the issue, this looks like a really nice solution for local viewing of odML files.

We will check the approach and see if we can include it in the next release.

morales-gregorio commented 4 years ago

Hey all,

I was just discussing this issue with @sunfzjuelich, @JuliaSprenger and @mdenker beacuse it would be really cool to have a locally viewable file directly coming out from odml!

A solution similar to the way @sunfzjuelich integrated the stylesheet in odml would be perfect for me, since I am working on a data publication that is in its final stages. It would be really helpful to have odml metadata to be viewable in any browser for the publication. It would make odml so much more useful for our target audience (who are potentially windows/mac based and not too keen on python).

All best, Aitor

mpsonntag commented 4 years ago

@sunfzjuelich, @morales-gregorio, I just finished implementing a prototype but am still working out the kinks. I'll try to release a version until the end of the week.

morales-gregorio commented 4 years ago

Sounds awesome! :)

mpsonntag commented 4 years ago

@sunfzjuelich @morales-gregorio I just released a new odml version on PyPI containing the inline style option.

morales-gregorio commented 4 years ago

Just tried it and it works like a charm! From my side this solves the issue. Thanks a lot!

ghost commented 4 years ago

OK, then I close this issue.

Thanks!