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

RE: XSL fragment within Javascript not-well formed!!!!

Subject: RE: XSL fragment within Javascript not-well formed!!!!!
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Wed, 26 May 2004 10:53:53 -0400
javascript not well formed
> From: Steve Brown [mailto:stevebrown@xxxxxxxxx] 
> Here is my trouble...
> I would like to dynamically generate the test condition for a 
> 'when' element using javascript. But, I can't even get the 
> code below to work because the 
> "MSXML2.FreeThreadedDOMDocument.3.0" parser expects the 
> closing 'when' tag before the closing script tag.
> <script type="text/javascript">
>   <![CDATA[document.write(']]><xsl:choose><xsl:when
> test="FName='Steve'"><![CDATA[');]]>
> </script>

The parser is closing the CDATA block when it finds the ']]>' in
document.write.   What follows is not well-formed, so the parser

I think you need to rethink your approach.  Using javascript code to
write html into a page can be fine, and generating that code using a
stylesheet can be fine - I do both of them myself.  But you rarely if
ever need to use a CDATA block (and HTML does not understand CDATA), and
you should always create complete nodes, not partial nodes.

In your following post, you said you want to change contents of a table
based on user selections,and when that happens the select lists need to
change too.  I suggest that you store that table data in javascript
form, probably using lists and associative arrays,and use javascript
within the page to rearrange the table and to reload the select lists
using the stored data.  You can have the stylesheet write the javascript
*containing the data* into the page, but you won't need to change the
styesheet and rerun it after that.

This approach will be much easier to develop and maintain.  You will be
able to mock up the page by hand and get the javascript working right,
separate from stylesheet development.  And the results will work across
more browsers and platforms than your current approach, which will
apparently be limited to IE.


Tom P

Current Thread


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.
First Name
Last Name
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.