[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSL within HTML javascript

Subject: XSL within HTML javascript
From: "Jason Lustig" <lustig@xxxxxxxxxxx>
Date: Sat, 30 Nov 2002 16:45:23 -0500
xsl within html
Hi everyone

I'm fairly new with XSL, and am working on a decently large project with
it. I'm creating a number of skins for a web design that is written in
XML, with HTML embedded. It's working fine for the most part, and I'm
working on a skin where it takes the navigation information (that's in
the xml) and transforms it into some javascript that'll make some DHTML
menus.

The XML for the nav looks something like this:

<navigation>
	<navigation-group name="Home" id="home">
		<item url="./main.asp" id="homeitem">Home</item> 
	</navigation-group>
	<navigation-group name="General Information" id="generalinfo">
		<item url="./upcomingprograms.asp"
id="upcomingprograms">Upcoming Programs</item> 
		<item url="./news.asp" id="news">Chapter News</item> 
		<item url="./list.asp" id="list">Announcements
Listserv</item> 
	</navigation-group>
</navigation>

... and I have (within an XSL template) this code:


<script>
oCMenu.makeMenu('cyptop','','Chapter Yellowpages','{$base}');

	<xsl:apply-templates select="./navigation"/>
</script>


Now, my problem is that when the parser (MSXML 3) goes through this part
of the XSL, it doesn't parse it -- it just spits out what's within the
<script></script> tags. The {$base} doesn't turn into the base URI
(which is defined as a global variable earlier in the XSL file), and my
<xsl:apply-templates/> tag isn't parsed at all -- it is spit out exactly
the way it is in there. The HTML, as it comes out of the XSL script when
it's parsed, looks like this:

<script>
oCMenu.makeMenu('cyptop','','Chapter Yellowpages','{$base}');

	<xsl:apply-templates select="./navigation"/>
</script>


... which is (obviously) exactly what the XSL is, when it's **supposed**
to parse the XSL and turn it into the javascript that is going to make
the menus. So the problem (at least what it looks like to me) is that it
doesn't parse XSL within a javascript <script></script> block.

Is there any way to fix this? It doesn't make sense that it would be
acting like this; I don't know why a <script></script> block would be
any different than a <p></p> block or a <div></div> block. I've checked
over the archives, and all over the web, and I can't seem to find an
answer to this problem... thanks in advance!

--Jason


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.