[docbook-apps] Using MathML XSL Stylesheets with XHTML and HtmlHelp, again

2009-12-01 Thread Magnus Gäfvert




Hi docbook experts!

I am struggling to get MathML to work with htmlhelp. The only useful
reference I found was this
http://markmail.org/thread/5kxwqwx3uihdytv2 thread on this
list, where Dean seems to have got this to work. Unfortunately,
repeating (at the best of my skills) his steps does not succeed for me.

As described, I made a customization layer xsl (see
attachment modelon-htmlhelp.xsl). The transformation (xsltproc with
docbook xsl 1.75.2) passes fine and a set of files (index.htm.xml,
ch01.htm.xml, etc) are generated. The generated xml files have the head
elements (before html):
?xml version="1.0" encoding="UTF-8" standalone="no"?
?xml-stylesheet type="text/xsl" href=""?!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0  
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"

Compilation with MS help compiler generate the warnings described in
Dean's post
and a chm file is generated.

Now, opening the .chm file shows the document outline but not page
contents. The following error is displayed:
The XML page cannot be displayed 
Cannot
view XML input using XSL style sheet. Please correct the error and then
click the Refresh
button, or try again later. 

System
error: -2146697204. Error processing resource
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'.


The same error is reported when opening index.htm.xml in IE 8. It
displays fine in Firefox.

I am quite new to docbook and xslt, so I may have misinterpreted the
instructions. Any help or hints to what is wrong would be very much
appreciated.

I got xhtml output to work on IE (see attachment
modelon-xhtml.xsl), using the header tags
?xml version="1.0" encoding="UTF-8" standalone="no"?
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd"

I also tried this dtd with htmlhelp, but without success.

Again, I would be much grateful for any hints or help on this matter.

/Magnus



?xml version='1.0'?
xsl:stylesheet  
xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0

xsl:param name=section.autolabel select=1/
xsl:param name=section.autolabel.max.depth select=3/

/xsl:stylesheet 
?xml version='1.0'?
xsl:stylesheet  
xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0

xsl:import href=xhtml-1_1/onechunk.xsl/
xsl:include href=modelon-common.xsl /

xsl:param name=chunker.output.doctype-public-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN/xsl:param

xsl:param name=chunker.output.doctype-systemhttp://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd/xsl:param

xsl:param name=html.stylesheet select='docbook.css'/

/xsl:stylesheet 
?xml version='1.0'?
xsl:stylesheet  
xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0

!-- http://www.mail-archive.com/docbook-apps@lists.oasis-open.org/msg11927.html --

xsl:import href=htmlhelp/htmlhelp.xsl/
xsl:include href=modelon-common.xsl /

xsl:template name=user.preroot
xsl:processing-instruction  name=xml-stylesheet
xsl:texttype=text/xsl href=mathml.xsl/xsl:text
/xsl:processing-instruction
/xsl:template

xsl:param name=html.ext.htm.xml/xsl:param

!--
xsl:param name=chunker.output.doctype-public-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN/xsl:param

xsl:param name=chunker.output.doctype-systemhttp://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd/xsl:param
--

xsl:param name=chunker.output.doctype-public-//W3C//DTD XHTML 1.0  
Transitional//EN/xsl:param

xsl:param  
name=chunker.output.doctype-systemhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd/xsl:param

xsl:param  name=chunker.output.omit-xml-declarationno/xsl:param
xsl:param  name=chunker.output.methodxml/xsl:param
xsl:param  name=chunker.output.indentyes/xsl:param
xsl:param  name=chunker.output.standaloneno/xsl:param
xsl:param  name=chunker.output.encodingUTF-8/xsl:param

xsl:param  name=htmlhelp.hhp.tail mathml.xsl
ctop.xsl
pmathml.xsl
pmathmlcss.xsl
/xsl:param

xsl:param name=html.stylesheet select='docbook.css'/

/xsl:stylesheet 
# Copy this template to your docbook project directory and rename to Makefile.
# Set the DOC variable to the document name (the prefix of your docbook xml 
file, exclude the .xml suffix):
DOCDIR=/C/JModelica.org-SDK/src/docbook/UsersGuide
DOC=JModelicaUsersGuide
DOCFILE=$(DOCDIR)/$(DOC).xml
XSLHTMLSTYLE=$(DOCBOOK_HOME)/modelon-html-IE.xsl
XSLXHTMLSTYLE=$(DOCBOOK_HOME)/modelon-xhtml.xsl
XSLPDFSTYLE=$(DOCBOOK_HOME)/modelon-fo.xsl
XSLHTMLHELPSTYLE=$(DOCBOOK_HOME)/modelon-htmlhelp.xsl

#http://docbook.sourceforge.net/release/xsl/current/doc/html/index.html
$(DOC).xhtml:  $(DOCFILE)
xsltproc  --xinclude  --output  $@ \
$(XSLXHTMLSTYLE)  $
mv index.html $(DOC).xhtml

xhtml:  $(DOC).xhtml

$(DOC).html:  $(DOCFILE)
xsltproc --xinclude  --output  $@ \
$(XSLHTMLSTYLE)  $

html:  $(DOC).html

# http://docbook.sourceforge.net/release/xsl/current/doc/fo/index.html
$(DOC).fo:  $(DOCFILE)
rm -f $(DOC).fo
xsltproc --xinclude  

Re: [docbook-apps] Using MathML XSL Stylesheets with XHTML and HtmlHelp, again

2009-12-01 Thread DeanNelson
Magnus,
 
MathML for the HTMLHelp is really touchy. I had it working and then I fixed 
 it! Not sure what I did to make it work last year, but I can look into it. 
I  retraced my steps and came up with the same results that you did.
 
Regards,
Dean Nelson
 
 
In a message dated 12/1/2009 5:56:07 A.M. Pacific Standard Time,  
magnus.gafv...@modelon.se writes:

Hi  docbook experts!

I am struggling to get MathML to work with htmlhelp.  The only useful 
reference I found was this _http://markmail.org/thread/5kxwqwx3uihdytv2_ 
(http://markmail.org/thread/5kxwqwx3uihdytv2)   thread on this list, where Dean 
seems to have got this to work. Unfortunately,  repeating (at the best of my 
skills) his steps does not succeed for  me.

As described, I made a customization layer xsl (see attachment  
modelon-htmlhelp.xsl). The transformation (xsltproc with docbook xsl 1.75.2)  
passes 
fine and a set of files (index.htm.xml, ch01.htm.xml, etc) are  generated. The 
generated xml files have the head elements (before  html):
?xml version=1.0 encoding=UTF-8 standalone=no?

?xml-stylesheet type=text/xsl href=mathml.xsl?!DOCTYPE html PUBLIC 
-//W3C//DTD XHTML 1.0  

Transitional//EN 
_http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd_ 
(http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd) 

Compilation with MS help compiler generate the warnings described in  
Dean's post and a chm file is generated.

Now, opening  the .chm  file shows the document outline but not page 
contents.  The following  error is displayed:
The XML page cannot be displayed  
Cannot  view XML input using XSL style sheet. Please correct the error and 
then click  the _Refresh_ (javascript:location.reload())  button, or try 
again later.   

  
System  error: -2146697204. Error processing resource 
'_http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd_ 
(http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd) '.  
The same error is reported when opening index.htm.xml in IE 8. It  displays 
fine in Firefox.

I am quite new to docbook and xslt, so I may  have misinterpreted the 
instructions. Any help or hints to what is wrong would  be very much 
appreciated.

I got xhtml output to work on IE (see  attachment modelon-xhtml.xsl), using 
the header tags
?xml version=1.0 encoding=UTF-8 standalone=no?

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 
1.1//EN _http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd_ (http://w
ww.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd) 

I also tried this dtd with htmlhelp, but without success.

Again,  I would be much grateful for any hints or help on this  matter.

/Magnus



?xml  version='1.0'?
xsl:stylesheet  
xmlns:xsl=http://www.w3.org/1999/XSL/Transform;  version=1.0

xsl:param name=section.autolabel  select=1/
xsl:param name=section.autolabel.max.depth  select=3/

/xsl:stylesheet 


?xml  version='1.0'?
xsl:stylesheet  
xmlns:xsl=http://www.w3.org/1999/XSL/Transform;  version=1.0

xsl:import  href=xhtml-1_1/onechunk.xsl/
xsl:include  href=modelon-common.xsl /

xsl:param  name=chunker.output.doctype-public-//W3C//DTD XHTML 1.1 plus 
MathML 2.0  plus SVG 1.1//EN/xsl:param

xsl:param  
name=chunker.output.doctype-systemhttp://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd/xsl:param

xsl:param  name=html.stylesheet  select='docbook.css'/

/xsl:stylesheet  


?xml version='1.0'?
xsl:stylesheet  
xmlns:xsl=http://www.w3.org/1999/XSL/Transform;  version=1.0

!--  
http://www.mail-archive.com/docbook-apps@lists.oasis-open.org/msg11927.html  --

xsl:import  href=htmlhelp/htmlhelp.xsl/
xsl:include href=modelon-common.xsl  /

xsl:template  name=user.preroot
xsl:processing-instruction   name=xml-stylesheet
xsl:texttype=text/xsl  href=mathml.xsl/xsl:text
/xsl:processing-instruction
/xsl:template

xsl:param  name=html.ext.htm.xml/xsl:param

!--
xsl:param  name=chunker.output.doctype-public-//W3C//DTD XHTML 1.1 plus 
MathML 2.0  plus SVG 1.1//EN/xsl:param

xsl:param  
name=chunker.output.doctype-systemhttp://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd/xsl:param
--

xsl:param  name=chunker.output.doctype-public-//W3C//DTD XHTML 1.0   
Transitional//EN/xsl:param

xsl:param   
name=chunker.output.doctype-systemhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd/xsl:param

xsl:param   name=chunker.output.omit-xml-declarationno/xsl:param
xsl:param   name=chunker.output.methodxml/xsl:param
xsl:param   name=chunker.output.indentyes/xsl:param
xsl:param   name=chunker.output.standaloneno/xsl:param
xsl:param   name=chunker.output.encodingUTF-8/xsl:param

xsl:param   name=htmlhelp.hhp.tail  mathml.xsl
ctop.xsl
pmathml.xsl
pmathmlcss.xsl
/xsl:param

xsl:param  name=html.stylesheet  select='docbook.css'/

/xsl:stylesheet 


# Copy  this template to your docbook project directory and rename to 
Makefile.
#  Set the DOC variable to the document name (the prefix of your docbook 
xml  file, exclude the .xml  suffix):
DOCDIR=/C/JModelica.org-SDK/src/docbook/UsersGuide

[docbook-apps] Using MathML XSL Stylesheets with XHTML and HtmlHelp

2008-10-31 Thread DeanNelson
All,
After much testing and many conversations on this maillist, I have MathML  
working for XHTML (on IE) and HtmlHelp. I used the XSL MathML stylesheets from  
W3Cso I did not have to deal with Java or JavaScript plug-ins. This solution 
is  primarily XSL based using the Docbook XSL 1.74. I used XSLTProc as a 
processor,  but I also tested it with Saxon 6.5.5.
 
This solution was prompted by the fact that HtmlHelp uses IE for rendering.  
IE does not natively support MathML like Mozilla does. If you are using 
Mozilla,  you do not have to use this method - Mozilla will just ignore it 
anyway.  
However, if you want to have a broader audience of browsers without relying on 
a  particular plug-in, this solution may work for you.
 

Please let me know if you have any comments.
 
Regards,
Dean Nelson
 
--
Preparation
Download the XSL stylesheets for MathML (_http://www.w3.org/Math/XSL/xsl.zip_ 
(http://www.w3.org/Math/XSL/xsl.zip) )  as mentioned in the 
_http://www.w3.org/Math/XSL/Overview-tech.html_ 
(http://www.w3.org/Math/XSL/Overview-tech.html) 
 document.
 
MathML/XHTML on Internet Explorer
To get the MathML rendered with the XSL stylesheets, XHTML must be used.  The 
following changes need to be made to the Docbook customization layer and  
processing.
 
1. Add the MathML stylesheet via the  user.preroot template:
 
xsl:template name=user.preroot
xsl:processing-instruction  name=xml-stylesheet
xsl:texttype=text/xsl href=mathml.xsl/xsl:text
/xsl:processing-instruction
/xsl:template

This lets the browser know that you have an XSL stylesheet that  you want to 
use. In this case, the mathml.xsl stylesheet from W3C. 
 
2. Make the output extension type XML
 
xsl:param name=html.ext.xml/xsl:param
 
MathML will only work with an XML file in Internet Explorer.
 
3. Copy the MathML XSL stylesheets to the same directory as the output file  
(for convenience of reference). You can place it in a directory and adjust  
the path and filename in step 1, if required.


HtmlHelp 
 
 
1. Add the stylesheet via the  user.preroot parameter:
 
xsl:template name=user.preroot
xsl:processing-instruction  name=xml-stylesheet
xsl:texttype=text/xsl href=mathml.xsl/xsl:text
/xsl:processing-instruction
/xsl:template


This lets the browser know that you have an XSL stylesheet that  you want to 
use. In this case, the mathml.xsl stylesheet from  W3C. 

2. Make the output extension type XML
 
xsl:param name=html.ext.htm.xml/xsl:param
 
HtmlHelp needs a file extension to start with .h.

3. Copy the MathML XSL stylesheets to the same directory as the output  file.



4. Add additional chunking parameters. This is because the stock HTMLHELP  
stylesheets do not emit XML declarations.
 
xsl:param name=chunker.output.doctype-public-//W3C//DTD XHTML 1.0  
Transitional//EN/xsl:param
xsl:param  
name=chunker.output.doctype-systemhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd/xsl:param
xsl:param  name=chunker.output.omit-xml-declarationno/xsl:param
xsl:param  name=chunker.output.methodxml/xsl:param
xsl:param  name=chunker.output.indentyes/xsl:param
xsl:param  name=chunker.output.standaloneno/xsl:param
xsl:param  name=chunker.output.encodingUTF-8/xsl:param  (or whatever  
locale setting you need)
 
 
5. Adjust/add the stylesheets to the tail of HELP.
 
 xsl:param  name=htmlhelp.hhp.tail mathml.xsl
ctop.xsl
pmathml.xsl
pmathmlcss.xsl
/xsl:param
 
This is also a good place to add any CSS stylesheets that you are  using.

6. Process the HtmlHelp and ignore the messages that say HHC3004: Warning:  
toc.hhc : The HTML tag ?xml version=1.0 encoding=iso-8859-1 standalon... 
 is not a valid HTML tag (it does not begin with an alphanumeric  character).
 
-

**Plan your next getaway with AOL Travel.  Check out Today's Hot 
5 Travel Deals! 
(http://pr.atwola.com/promoclk/10075x1212416248x1200771803/aol?redir=http://travel.aol.com/discount-travel?ncid=emlcntustrav0001)