RE: [xsl] Getting date of the XSL transformation into HTML output

Subject: RE: [xsl] Getting date of the XSL transformation into HTML output
From: "LAJ" <shaard@xxxxxxxxxxxxxx>
Date: Fri, 20 Jul 2001 13:34:28 +0100
Ahhh I see your problem...I cant see anyway of passing a parameter using
those tools however I'm a newbie so what do I know? ;)

I should probably leave this reply to Rene but what the hell. Taking Rene's
example create an html file containing the following

<html>

	<body>

		<script type="text/javascript">
			// Load your XSL
			var objXSLT = new ActiveXObject("MSXML2.FreeThreadedDomDocument")
			objXSLT.async = false
			objXSLT.load("YourStylesheet.xsl")

			// create a compiled XSL-object
			var objCompiled = new ActiveXObject("MSXML2.XSLTemplate")
			objCompiled.stylesheet = objXSLT.documentElement

			// create XSL-processor
			var objXSLProc = objCompiled.createProcessor()

			// Load your XML
			var objXML = new ActiveXObject("MSXML2.FreeThreadedDomDocument")
			objXML.async = false
			objXML.load("YourXML.xml")

			// input for XSL-processor
			objXSLProc.input = objXML
			objXSLProc.addParameter("date", Date())
			// etc.

			// transform
			objXSLProc.transform()

			// display
			document.write(objXSLProc.output)
		</script>

	</body>

</html>

Substitute the stylesheet and XML filenames as appropriate. Modify your
stylesheet and add in

<xsl:param name="date"/>

you can then access the date parameter you have passed by using
<xsl:value-of select="$date"/>

To view this of course you then have to load up the html file that you
created rather than executing the transformation through xmlspy.

Hope that helps rather than hinders (i.e. I hope I'm right and not leading
you up the garden path heheh )

Lee


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Ghostrider
Sent: 20 July 2001 11:54
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Getting date of the XSL transformation into HTML
output


Hi Rene (and Lee)

[it seems my previous reply didn't make the list for some reason so I'm
posting this again]

Rene wrote:

>I don't quite understand your problem.
>The date your XSL is generating the HTML is the current date isn't it?

Yes

>So why not use one of the suggestions how to get the current date and use
the
><xsl:value-of select="the current-date-function of your choice"/> to
hardcode
it into your HTML?

And what would that current-date-function look like? I really have no idea
(as
to syntax, use,...)!

>And if you're using msxml3 (or just IE) and want to know how to pass a
>parameter: see my earlier mail: http://www.biglist.com/lists/xsl-
>list/archives/200107/msg00002.html

I'm using XMLSpy and MSXML3.
I had a look at your example code but i don't know

1. where to put in my XSL
2. how to adapt it to so I get the current date in the output HTML

As to your reply, Lee:

Same problem: how do I use a param to actually get that date?
I'd appreciate any help on this (though i didn't think it would be this
complicated to get it done).

Thanks everyone,

Armin


 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