[no subject]

From: "Railan, Puneet Mr., RCI - Vienna" <prailan@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 19 Jul 2002 09:11:37 -0400
Ms. Tennison:

I tried it, and in the HTML output, it just put quotes around the last string, which is fine, but I still get similar errors.  I'll paste them right here:

Error: Expected ']' <----I have narrowed this down to having to do with one of the .js files (as when they're not in the same directory as they should be, the error goes away).

Error: Object Expected <----I get this one now that I've put in those quotes, instead of it having expected a ')' like before.  I suspect it's something to do with my inline javascript code, but I don't know what.

I'll also better explain what I'm attempting to do.  What my original intentions were, were to create a frame, and to display the main document by using only one XML file, and one XSL file.  I was able to get the formatting down, and to have the Table of Contents created, but of course you need two seperate files for it to work, and you can't just pass HTML to the frame src and expect it to display.  So, after having messed around with this for a day or two, I came to the conclusion that it was impossible without some .JSP tossed in.  I then found this javascript application (it can be found here: http://www.dynamicdrive.com/dynamicindex1/davidmenu.htm) that has a javascript menu that will slide out when you put your mouse over it.  However, this script uses a static list, and what I wanted to do was to create one that will take my values and create it on the fly.  Hence the ssmItems and passing the data from the XSL into a JavaScript file.  After looking at some Javascript, I came up with the idea of calling a function to bring the data back.  You can now see where that's gotten me.  Also, when I try to count the //sectiontitle //title and //subtitle, it shows up with about 30 more things then it should, and I have NO idea how and/or why.  If there's anyway to get this stuff to work, either the Frame or the JavaScript app, please do let me know.  The reason I need them is that this document is fairly large (roughly 70-80 pages) and navigation is no small pain.  Thanks again.

-P

-----Original Message-----
From: Jeni Tennison [mailto:jeni@xxxxxxxxxxxxxxxx]
Sent: Friday, July 19, 2002 5:11 AM
To: Railan, Puneet Mr., RCI - Vienna
Cc: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] JavaScript and XSL Problems


Hi Puneet,

>> XSL Code Fragment:
>> 
>> <xsl:template match="//sectiontitle" mode="toc">
>>       <script type="text/javascript">
>>                       collectData(<xsl:value-of select="count(//sectiontitle)+count(//title)+count(//subtitle)"/>, l, <xsl:value-of select="normalize-space(.)"/>);
>>                       l++;
>>       <xsl:for-each select="..//title">
>>                       collectData(<xsl:value-of select="count(//sectiontitle)+count(//title)+count(//subtitle)"/>, l, <xsl:value-of select="normalize-space(.)"/>);
>>                       l++;
>>               <xsl:for-each select="..//subtitle">
>>                       collectData(<xsl:value-of select="count(//sectiontitle)+count(//title)+count(//subtitle)"/>, l, <xsl:value-of select="normalize-space(.)"/>);
>>                       l++;
>>               </xsl:for-each>
>>       </xsl:for-each>
>>       </script>
>> </xsl:template>

If you look at the JavaScript generated by this code, you'll see
something along the lines of:

  <script type="text/javascript">
    collectData(12, l, a lot of text...);
    l++;
    collectData(12, l, some more text...);
    l++
    collectData(12, l, yet more text...);
    l++;
    ...
  </script>

I suspect that the problem is that the third argument to your
collectData function, as you're generating it, hasn't got any quotes
around it. If you change those lines that generate the
"collectData(...)" call to:

  collectData(
    <xsl:value-of select="count(//sectiontitle)+count(//title)+count(//subtitle)"/>,
    l,
    "<xsl:value-of select="normalize-space(.)"/>");

So that double quotes are generated around the last argument, you
might have better luck.

By the way, are you sure that you want the first argument to be the
same for each call to the collectData() function?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/




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


Current Thread
  • [no subject]
    • Railan, Puneet Mr., RCI - Vienna - Fri, 19 Jul 2002 09:11:37 -0400 <=