Menu

#27 Linked CSS contents in XHTML are not included/patched

open
nobody
None
5
2012-12-21
2010-05-28
No

When xsltforms.xsl is processing an (X)HTML document with a linked CSS resource, it tries loading it with document(@href,/) so its contents are preprocessed/patched. The problem is that XSLT processors usually do not allow reading plain text files (ab)using XSL document function, only XML ones. This happens, for instance, with Firefox 3.0.6, Webkit engine and xsltproc. So, at the end, the translated document contains neither references to the original CSS resource nor translated content of the CSS resource.

I have a suggestion to fix this bug. Using Javascript, it would be easy with XMLHttpRequest to fetch linked CSS resources from the client side, in order to patch them and include as dynamic CSS contents.

Discussion

  • José María Fernández

    I forgot to say that this is with SVN trunk (r406)

     
  • Alain Couthures

    Alain Couthures - 2010-06-03

    Adding a document element such as <css> will permit the XSLT processor to parse CSS instructions.

    This is how it is supported now...

    -Alain

     
  • José María Fernández

    Thanks for the tip!

    A couple of weeks I developed a prototype (it is half-functional) which delegates the job in Javascript code. I'm including the diff and the javascript file after this comment, in the hope it can help.

     
  • José María Fernández

    Diff of the prototype against XSLTForms r407

     
  • José María Fernández

    The javascript code used by generated javascript sentences from previous diff

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.