LISTSERV mailing list manager LISTSERV 15.5

Help for XML-L Archives

XML-L Archives

XML-L Archives


Next Message | Previous Message
Next in Topic | Previous in Topic
Next by Same Author | Previous by Same Author
Chronologically | Most Recent First
Proportional Font | Monospaced Font


Join or Leave XML-L
Reply | Post New Message
Search Archives

Subject: Re: Can we have one xml document pointing to two style sheets??
From: Elliotte Rusty Harold <[log in to unmask]>
Reply-To:General discussion of Extensible Markup Language <[log in to unmask]>
Date:Tue, 3 Apr 2001 15:03:10 -0400

text/plain (61 lines)

At 6:56 PM +0200 4/3/01, Janning Vygen wrote:
>Am Dienstag,  3. April 2001 16:20 schrieb Dan Diebolt:
>>  > Is it possible to have one xml document reference to use  2different =
>>  > style sheets.
>>  Get in the habit of trying your ideas out. My tests indicate if you
>>  put two <?xml-stylesheets ?>'s into your xml, only the first is
>>  applied:
>>     <?xml version="1.0"?>
>>     <?xml-stylesheet type="text/xsl" href="TwoStyleSheetsInOneXml1.xsl"?>
>>     <?xml-stylesheet type="text/xsl" href="TwoStyleSheetsInOneXml2.xsl"?>

>I have read things like that, but i canĄt remember in which book, so this
>infomation must not be the truth:

XML in a Nutshell suggests this. Doubtless other books do too. I
didn't make it up out of whole cloth. :-)

However, you need to give the application reading the XML document
and applying the stylesheet some means of choosing between the
different style sheets. You could do this with different value of
type, text/css for CSS and text/xml for XSLT for example:

<?xml-stylesheet type="text/xml" href="onestylesheet.xsl"?>
<?xml-stylesheet type="text/css" href="onestylesheet.css"?>

(By the way, there is no such MIME media type as text/xsl. It's a
figment of Microsoft's imagination.)

You can also use the media, alternate, and title pseudo-attributes to
distinguish between different style sheets of the same type. For

<?xml-stylesheet type="text/css" href="recipe.css" media="screen"
              alternate="no"  title="For Web Browsers" charset="US-ASCII"?>
<?xml-stylesheet type="text/css" href="printable_recipe.css" media="print"
              alternate="no" title="For Printing" charset="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="big_recipe.css" media="projection"
              alternate="no" title="For presentations" charset="UTF-8"?>
<?xml-stylesheet type="text/css" href="tty_recipe.css" media="tty"
              alternate="no" title="For Lynx" charset="US-ASCII"?>
<?xml-stylesheet type="text/css" href="small_recipe.css" media="handheld"
              alternate="no" title="For Palm Pilots" charset="US-ASCII"?>


| Elliotte Rusty Harold | [log in to unmask] | Writer/Programmer |
|                  The XML Bible (IDG Books, 1999)                   |
|                   |
|   |
|  Read Cafe au Lait for Java News: |
|  Read Cafe con Leche for XML News:     |

Back to: Top of Message | Previous Page | Main XML-L Page



CataList Email List Search Powered by the LISTSERV Email List Manager