Re: Problem in referencing DHTML 'document' object within <xsl:script>

Subject: Re: Problem in referencing DHTML 'document' object within <xsl:script>
From: "John McKeown" <mckeowj@xxxxxxxxx>
Date: Wed, 14 Apr 1999 16:49:02 +0100
I don't think you can access the 'document' object in the way you are trying
to, but you can set the title of a page using script in the stylesheet as
outlined below.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
  <xsl:script LANGUAGE="JSCRIPT"><![CDATA[
 function WriteDocTitle()
        {
  return "Document Title";
        }
  ]]></xsl:script>
  <xsl:template match="/">
    <HTML>
      <HEAD>
 <TITLE>
 <xsl:eval language="JScript">WriteDocTitle();</xsl:eval>
 </TITLE>
      </HEAD>
      <BODY>

      </BODY>
    </HTML>
  </xsl:template>
</xsl:stylesheet>

John

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
John McKeown
Knowledge & Data Engineering Group
Department of Computer Science
O'Reilly Institute
University of Dublin, Trinity College
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
----- Original Message -----
From: Amit Rekhi <amitr@xxxxxxxxxxxxx>
To: xsl list <xsl-list@xxxxxxxxxxxxxxxx>
Sent: Wednesday, April 14, 1999 10:49 AM
Subject: Problem in referencing DHTML 'document' object within <xsl:script>


>Hello,
>
>ENVIRONMENT
>- Browser :- MS IE5
>- DOM Implementation :- Specific to IE5
>- DHTML Object Model :- Specific to IE5
>
>PROBLEM STATEMENT
>I am trying to use the 'document' object exposed by
>IE5 DHTML Object Model within an <xsl:script> which
>is called from an XSL template as follows :-
>.
>.
>1.<?xml version="1.0"?>
>2.<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
>3. <xsl:script language="JScript">
>4.  function WriteDocTitle()
>5.  {
>6.    document.title = "Document Title";
>7.  }
>8. </xsl:script>
>9. <xsl:template match="/">
>10.   <HTML>
>11.     <HEAD>
>12.       <xsl:eval language="JScript">WriteDocTitle()</xsl:eval>
>13.     </HEAD>
>14.   </HTML>
>15. </xsl:template>
>16.</xsl:stylesheet>
>
>But on processing the above XSL stylesheet
>IE5 gives me the following error message:
>
>"Microsoft JScript runtime error
>'document' is undefined line = 7, col = 3
>(line is offset from the tag).
>Error returned from property or method call."
>
>QUESTIONS
>* What change do I need to make to the above
>XSL fragment so that the 'document' element
>could be recognised?
>
>* Does the 'document' element stand for the
><HTML> element at LineNumber = 10. (see above)?
>If not what does the 'document' element stand for
>in the context of the above XSL stylesheet?
>
>* What do I need to do to access the <HTML> element at
>LineNumber = 10 (see above) within the WriteDocTitle() function
>(at LineNumber = 4)?
>
>Thanks in advance for any replies,
>AMIT
>
>
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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


Current Thread