This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: document.write
- From: "Robert Koberg" <rob at koberg dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 29 Nov 2001 12:11:15 -0800
- Subject: Re: [xsl] document.write
- References: <C1256B13.00622D0E.00@smtp20.infotn.it>
- Reply-to: xsl-list at lists dot mulberrytech dot com
What does you html output look like? Is your output set to html? But I
would bet a million lira that it could be done without js :)
try:
<xsl:template match="Car_Status_Descr">
<!-- instead of xsl:script -->
> <script>
> names= new String("01; 02; 03; 04")
// you are limited to javascript 1.2 if you use regexp
> //pattern=/\s*;\s*/
> nameList = names.split('; ')
> for (i=0; i < (nameList.length); (i++)) {
> n = nameList[i];
> if (n=="01") {
>
> document.write(n + "Anna Stefani" + "")
>
> }
> if (n=="02") {
>
> document.write(n + "Harry Potter" + "")
>
> }
>
> }
> </script>
> </xsl:template>
best,
-Rob
----- Original Message -----
From: <anna.stefani@infotn.it>
To: <xsl-list@lists.mulberrytech.com>
Sent: Thursday, November 29, 2001 9:52 AM
Subject: [xsl] document.write
>
>
> I have a problem with scripts in xsl.
> I test to include script in this way:
>
> <xsl:template match="Car_Status_Descr">
> <xsl:script>
> names= new String("01; 02; 03; 04")
> pattern=/\s*;\s*/
> nameList = names.split(pattern)
> for (i=0; i < (nameList.length); (i++)) {
> n = nameList[i];
> if (n=="01") {
>
> document.write(n + "Anna Stefani" + "")
>
> }
> if (n=="02") {
>
> document.write(n + "Harry Potter" + "")
>
> }
>
> }
> </xsl:script>
> </xsl:template>
>
> But IE Explorer reply me "Microsoft JScript runtime error 'document' is
> undefined line ".
> I try to change script in this way below but don't work.
>
>
> <xsl:template match="Car_Status_Descr">
> <SCRIPT LANGUAGE="Javascript1.2">
> names= new String("01; 02; 03; 04")
> pattern=/\s*;\s*/
> nameList = names.split(pattern)
> for (i=0; i < (nameList.length); (i++)) {
> n = nameList[i];
> if (n=="01") {
>
> document.write(n + "Anna Stefani" + "")
>
> }
> if (n=="02") {
>
> document.write(n + "Harry Potter" + "")
>
> }
>
> }
> </SCRIPT>
> </xsl:template>
>
>
> I try to insert this javascript in a very simple web page (html) and it
works
> correctly.
> I don't understand where is the problem??? How can I do it???
>
> Thanks,
> Regards,
> Anna.
>
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list