Re: Q: How to select different style sheets at run time?

Subject: Re: Q: How to select different style sheets at run time?
From: Rick Geimer <rick.geimer@xxxxxxx>
Date: Fri, 20 Aug 1999 09:58:40 -0700
Heiko,

I know you can do this with ASP or VBSCRIPT using MSXML, but then you
are stuck using their XSL implementation. Oh well...I believe the
following works if you are interested:

<%@Language=VBScript%>
<%

  Set XMLDoc = Server.CreateObject("Microsoft.XMLDOM")
  Set XSLDoc = Server.CreateObject("Microsoft.XMLDOM")
  XMLDoc.async = false
  XMLDoc.load(Server.MapPath("test.xml"))
  XSLDoc.async = false
  XSLDoc.load(Server.MapPath("test.xsl"))
 
response.write(XMLDoc.documentElement.transformNode(XSLDoc.documentElement))

%>

Also note that I wasn't able to use an <xsl:stylesheet> element in my
XSL file, because for some reason it didn't like it. I had to use
something like the following:

	<HTML xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
	  <BODY STYLE="font-family:Arial, helvetica, sans-serif;
font-size:12pt; background-color:#EEEEEE">
		<xsl:apply-templates select="//*">
			<xsl:template match="foo">
				<H1><xsl:value-of/></H1>
			</xsl:template>
		</xsl:apply-templates>
	   </BODY>
	</HTML>

Have fun.

Rick Geimer
National Semiconductor
rick.geimer@xxxxxxx

heiko.grussbach@xxxxxxxx wrote:
> 
> And if I develop a new stylesheet later on, I have to go through all
> documents to add it? Isn't it possible to store this relation (document <->
> stylesheets) outside the document?
> 
> Regards
> 
> Heiko
> Heiko.Grussbach@xxxxxxxx
> 
> (being a XSL newbie)
> 
> dog <dog@xxxxxxxxxx> on 20-08-99 09:47:42
> 
> Please respond to xsl-list@xxxxxxxxxxxxxxxx
> 
> To:   xsl-list@xxxxxxxxxxxxxxxx
> cc:    (bcc: Heiko Grussbach/NMG/CRP-HT)
> 
> Subject:  Re: Q: How to select different style sheets at run time?
> 
> todd.schwartz wrt:
> > I am wondering if anyone knows of a standard way to change the style
> sheet
> > applied to an XML document at run time. For example, I have a single XML
> > photo album document (see below) that contains both the thumbnail and
> > full-size versions of each photo. I have a default style sheet
> "album.xsl"
> > that displays a table with the thumbnails. What I would like is to
> somehow
> > make each thumbnail a link to the same XML document with a different
> style
> > sheet applied, say "photo.xsl". Microsoft has proprietary DOM extensions
> > that can do this; I was hoping there would be a more standard way. Seems
> > like there ought to be a way to specify "document + style sheet" in a
> URI...
> see http://www.w3.org/TR/xml-stylesheet paying attention to the 'alternate'
> attribute. your server/servlet/resource-implementation can select alternate
> stylesheets via information posted to a resource or by a url mechanism such
> as
>   http://host/images        to select the default (album.xsl) stylesheet
>   http://host/images?photo  to select the photo.xsl stylesheet
> dog
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread