[xsl] pushing XML to a javascript pop-up window

Subject: [xsl] pushing XML to a javascript pop-up window
From: Bryan Tarantina <bryantarantina@xxxxxxxxx>
Date: Mon, 1 Jul 2002 12:37:32 -0700 (PDT)
Hey everyone,

I have a rather interesting problem that I am having
trouble solving. I have a large XML file that is being
parsed into an HTML file. I have it almost finished
except for one last obstacle. In the XML document
structure is similar to a book, and when you click on
a link (say, copyright info) it opens up a pop-up
window that displays the information (stylized of
course)). 

Now, I can suppress the information in the master
document and create a link easily, but how do I push
the information into the new window? I have tried a
few different things, but to no avail. Everything I
have tried has been inserting javascript into the head
of the html document through the XSL and then doing
one of the two:

<SCRIPT language="javascript">
  		
	<xsl:text disable-output-escaping="yes">
	function legalinfo()
	{
		OpenWindow=window.open("", "newwin");
		OpenWindow.document.write('</xsl:text>
		<xsl:apply-templates select="Test1" />
		<xsl:text>')</xsl:text>

		<xsl:call-template name="Test2" />

		OpenWindow.document.close()
		self.name="main"
	}
	</xsl:text>
</SCRIPT>  

Here's what Test1 looks like:

<xsl:template match="Test1">
	<xsl:text>&lt;div class="Smalltext"&gt;</xsl:text>
	<xsl:apply-templates/>	
	<xsl:text disable-output-escaping="yes">
		OpenWindow.document.write('&lt;/div&gt;')
	</xsl:text>
</xsl:template>

which works up until the <xsl:apply-templates /> line.

Test2 will work nicely except that I have to know what
elements to call, and that doesn't work because this
XSL has to be generic enough to handle any book of
this format, so the problem comes in when you have to
display a numbered-list in one document but not in the
next, blah blah blah.

Any ideas on how I can accomplish this? As it stands
right now, I can't call the XMLDOM because I get an
error that the XML document has a top-level element
not specified in the DTD. However I can't change the
DTD...

Bryan

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

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


Current Thread