List Info

Thread: Alternate CSS stylesheets.




Alternate CSS stylesheets.
user name
2007-03-10 21:05:06
I currently use the following XSL fragment to include a css
stylesheet
in the resulting html documents:

------------------------------------------------------------
---------
<?xml version='1.0'?>
<xsl:stylesheet xmlnssl=&q
uot;http://www
.w3.org/1999/XSL/Transform"
                xmlns:fo="http://www.w3
.org/1999/XSL/Format"
                version="1.0">
  <xsl:param name="html.stylesheet"
      
select="'/home/gavron/devel/docbook/tests/css-dir/flb.c
ss'"/>
</xsl:stylesheet>
------------------------------------------------------------
----------

I proceed to generate the html document via a:

$ xmlto -vv -m ../fragment.xsl -o ../html-dir html
docfile.xml

Would anyone know whether I can use the same strategy to
specify
alternate css stylesheets that I can switch to on the fly
while browsing
the html document?

Or do I need to specify the alternate CSS style sheets in
the prolog of
each DocBook/XML document?

At this point I modify the XSL fragment above and regenerate
the html
documents every time I want to switch style sheets, which is
slow and
error-prone.  

So I was hoping there might be a better way to do this.

Thanks,
cga



------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-helplists.oasis-open.org


Re: Alternate CSS stylesheets.
user name
2007-03-11 05:41:23
cga2000 wrote:

> Would anyone know whether I can use the same strategy
to specify
> alternate css stylesheets that I can switch to on the
fly while browsing
> the html document?
> 
> Or do I need to specify the alternate CSS style sheets
in the prolog of
> each DocBook/XML document?
> 
> At this point I modify the XSL fragment above and
regenerate the html
> documents every time I want to switch style sheets,
which is slow and
> error-prone.  

You can emit all necessary link elements by overriding
user.head.content
 template:

<xsl:template name="user.head.content">
  <link .../>
  <link .../>
</xsl:template>

-- 
------------------------------------------------------------
------
  Jirka Kosek      e-mail: jirkakosek.cz      http://xmlguru.cz
------------------------------------------------------------
------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document
processing
------------------------------------------------------------
------
 OASIS DocBook TC member, W3C Invited Expert, ISO/JTC1/SC34
member
------------------------------------------------------------
------
 Want to speak at XML Prague 2007 => http://xmlprague.cz/cfp.
html

Re: Alternate CSS stylesheets.
user name
2007-03-11 11:25:33
On Sun, Mar 11, 2007 at 05:41:23AM EST, Jirka Kosek wrote:
> cga2000 wrote:
> 
> > Would anyone know whether I can use the same
strategy to specify
> > alternate css stylesheets that I can switch to on
the fly while browsing
> > the html document?
> > 
> > Or do I need to specify the alternate CSS style
sheets in the prolog of
> > each DocBook/XML document?
> > 
> > At this point I modify the XSL fragment above and
regenerate the html
> > documents every time I want to switch style
sheets, which is slow and
> > error-prone.  
> 
> You can emit all necessary link elements by overriding
user.head.content
>  template:
> 
> <xsl:template
name="user.head.content">
>   <link .../>
>   <link .../>
> </xsl:template>

I replaced my XSL fragment by:

------------------------------------------------------------
--------------
<?xml version='1.0'?>
<xsl:template name="user.head.content">
  <link href="walsh.css"
title="walsh" rel="stylesheet"
type="text/css"/>
  <link href="sgh.css" title="alt"
rel="alternate stylesheet"
type="text/css"/>
</xsl:template>
------------------------------------------------------------
--------------

ran:

$ xmlto -vv -m ../xsl-dir/alt1.xsl -o ../html-dir/cheat html
cheat.xml

And I get the following error:

------------------------------------------------------------
--------------
Format script: /usr/share/xmlto/format/docbook/html
Convert to HTML (with chunks)
Real stylesheet: http://docbook.sourceforge.net/release/xsl/curr
ent/html/chunk.xsl
xmllint >/dev/null --xinclude --postvalid
/home/gavron/devel/docbook/tests/xml-dir/cheat.xml
Stylesheet: /tmp/xmlto-xsl.ZgvmEr
xsltproc --nonet --xinclude 
 -o /tmp/xmlto.u4OQ5s/cheat.proc 
 /tmp/xmlto-xsl.ZgvmEr 
 /home/gavron/devel/docbook/tests/xml-dir/cheat.xml
/home/gavron/devel/docbook/tests/xml-dir/../xsl-dir/alt1.xsl
:2: namespace error : Namespace prefix xsl on template is
not defined
<xsl:template name="user.head.content">
                                      ^
compilation error: file
/home/gavron/devel/docbook/tests/xml-dir/../xsl-dir/alt1.xsl
line 2 element template
xsltParseStylesheetProcess : document is not a stylesheet
cp: cannot stat `*': No such file or directory
------------------------------------------------------------
--------------

Does this mean that he's not finding the
"user.head.content" template
on my system? 

Could this be because I do not have this particular template
installed
on my system, possibly because I'm running this on a system
that's
fairly ancient?

The only html template I found on my system is 

nwalsh/html/titlepage.templates.xsl.

Naturally, it could be just a syntax error in my coding.  I
don't know
XSL so I'm just guessing.

Thanks,
cga

------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-helplists.oasis-open.org


Re: Alternate CSS stylesheets.
user name
2007-03-11 15:45:31
cga2000 wrote:

> Naturally, it could be just a syntax error in my
coding.  I don't know
> XSL so I'm just guessing.

Then you should start by learning at least basics of XSLT
and how to use
it to customize XSL stylesheets:

http://www.sagehi
ll.net/docbookxsl/

-- 
------------------------------------------------------------
------
  Jirka Kosek      e-mail: jirkakosek.cz      http://xmlguru.cz
------------------------------------------------------------
------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document
processing
------------------------------------------------------------
------
 OASIS DocBook TC member, W3C Invited Expert, ISO/JTC1/SC34
member
------------------------------------------------------------
------
 Want to speak at XML Prague 2007 => http://xmlprague.cz/cfp.
html

Re: Alternate CSS stylesheets.
user name
2007-03-11 23:33:01
On Sun, Mar 11, 2007 at 03:45:31PM EST, Jirka Kosek wrote:
> cga2000 wrote:
> 
> > Naturally, it could be just a syntax error in my
coding.  I don't know
> > XSL so I'm just guessing.
> 
> Then you should start by learning at least basics of
XSLT and how to use
> it to customize XSL stylesheets:
> 
> http://www.sagehi
ll.net/docbookxsl/

I took a quick peek and came up with the following fragment
that does what 
I need:

------------------------------------------------------------
-----------------
<?xml version='1.0'?>
<xsl:stylesheet xmlnssl=&q
uot;http://www
.w3.org/1999/XSL/Transform"
                xmlns:fo="http://www.w3
.org/1999/XSL/Format"
                version="1.0">
 <xsl:param name="use.id.as.filename"
select="'1'"/>
 <xsl:param name="admon.graphics"
select="'1'"/>
 <xsl:param
name="admon.graphics.path"></xsl:param>
 <xsl:param name="chunk.section.depth"
select="2"></xsl:param>
 <xsl:param name="html.stylesheet"
   
select="'/home/gavron/devel/docbook/tests/css-dir/free-
templ/fbr.css'"/>
 <xsl:param name="section.autolabel"
select="1"/>
 <xsl:param name="toc.section.depth"
select="5"/>
 <xsl:template name="user.header.content">
  <link href="walsh.css"
title="walsh" rel="stylesheet"
type="text/css"/>
  <link href="bb.css" title="bb"
rel="alternate stylesheet"
type="text/css"/>
  <link href="bn.css" title="bn"
rel="alternate stylesheet"
type="text/css"/>
  <link href="br.css" title="br"
rel="alternate stylesheet"
type="text/css"/>
  <link href="gb.css" title="gb"
rel="alternate stylesheet"
type="text/css"/>
  <link href="gg.css" title="gg"
rel="alternate stylesheet"
type="text/css"/>
  <link href="gw.css" title="gw"
rel="alternate stylesheet"
type="text/css"/>
  <link href="lb.css" title="lb"
rel="alternate stylesheet"
type="text/css"/>
  <link href="ml.css" title="ml"
rel="alternate stylesheet"
type="text/css"/>
  <link href="mn.css" title="mn"
rel="alternate stylesheet"
type="text/css"/>
  <link href="sr.css" title="sr"
rel="alternate stylesheet"
type="text/css"/>
 </xsl:template>
/xsl:stylesheet>
------------------------------------------------------------
-----------------

Thanks,
cga





------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-helplists.oasis-open.org


[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )