When I last researched this (see p101 in XSLT Prog Ref 4th edition), I came
to the conclusion that IE always uses the first xml-stylesheet PI, and
Firefox always uses the last; neither takes any notice of the "alternate" or
"media" pseudo-attributes.
Regards,
Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay
-----Original Message-----
From: Dan Vint [mailto:dvint(_at_)dvint(_dot_)com]
Sent: 26 November 2009 18:47
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Print vs Screen XSLT stylesheets?
I've been building an XML based website. I've got a nice
working environment for the screen. I have the following association:
<?xml-stylesheet type="text/xsl"
href="scripts/slideshow-tables.xslt" media="screen"?>
This produces a slide show and a bunch of navigation
features. I want to make a corresponding "for print"
stylesheet. I added this:
<?xml-stylesheet type="text/xsl"
href="scripts/slideshow-tables.xslt" media="screen"?>
<?xml-stylesheet type="text/xsl" href="scripts/slideshow-print.xslt"
media="print"?>
My screen presentation switched to the print style - which I
didn't want. Looks like the last stylesheet read is what is
used. I made the next change:
<?xml-stylesheet alternate="yes" type="text/xsl"
href="scripts/slideshow-print.xslt" media="print"?>
The alternate='yes' seems to have at least kept my original
stylesheet being read for the screen. I'm not sure if the
media='screen' has anything to do with it. The media='print'
certainly is not producing the result I want. When I do a
print preview with FireFox, I don't get my new print arrangement.
FYI results seem to be the same in IE as well.
The xml-stylesheet spec indicates that this is supposed to
work like the <link> tag for CSS, so I thought this would
work. I need more support than what CSS will allow and I want
to write a second XSLT stylesheet to handle the different
formatting. The biggest thing I need to do is convert my
slideshow from Javascript arrays and a Javascript player to
be in line <img> references. That's the reason I want XSLT
instead of CSS for this task.
Any suggestions how I can handle this with XSLT/XML/HTML techniques?
I would like the stylesheet to be automatically triggered
when someone hits the print button. My only other thought is
to add a button on the webpage that will trigger some
Javascript to process the XML content with a different
stylesheet and then pop that up as a new window. Anyone got
some example code that would call an XML file and apply a stylesheet?
..dan
--------------------------------------------------------------
-------------
Danny Vint
Panoramic Photography
http://www.dvint.com
voice: 502-749-6179
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--