Menu

#127 highlight programmcode

open
nobody
XSLT (52)
5
2009-11-16
2009-11-16
No

We want to display program listings in our lessons for example java,c, php.
For better reading they should be displayed with sytax highlighting.
There are many tools for this problem written in Php (http://qbnz.com/highlighter/) or Javascript but I have not found a xslt-Skript to do this. The project https://sourceforge.net/projects/xslthl/ uses java functions but it only works with saxon and I think a more general implementation with pure xslt would be much better.
Does anyone know a solution for this?

Discussion

  • Marc Vorreiter

    Marc Vorreiter - 2009-11-16

    in elml this could be a new element like this

    <clarify>
    <code language="php" linenumbering="true">
    if ($a==1)
    {echo "1";}
    </code>
    </clarify>

    or you can use the paragraph or box-Element with a specific class

     
  • Joel Fisler

    Joel Fisler - 2009-11-25

    We use either <formatted type="code"> or then we use <paragraph> with a special CSS class. But I like the XSLT implementations you are mentioning. I think its not a problem if it only works with Saxon, nearly all of us work with Saxon. So have you implemented that into eLML?

     

Log in to post a comment.