JavaScript in XSLT

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • elsheh
    New Member
    • Nov 2006
    • 29

    JavaScript in XSLT

    Hi. Everyone
    I’m using xslt styllesheet to transform my xml doc. into an html doc. The task includes embedding some JavaScript code for validation purpose, till this point there is no problem everything is going right. Once I tried to get an xhtml doc instead of html, JavaScript problem was raised. In other words, the transformation is performed right apart from JavaScript problem which is, some of JavaScript special characters such as (< , >, &&) were converted into (&lt; , &gt; , ….) which cause some problems with validation task, despite the fact that all JavaScript code is placed between <![CDATA and ]]>. So, any clue to keep whole JavaScript code in its original form?

    Your help is much appreciated
  • dorinbogdan
    Recognized Expert Contributor
    • Feb 2007
    • 839

    #2
    Welcome to TheScripts TSDN....

    Do not use <, >, && , replace them by the appropriate HTML symbol.

    Comment

    • elsheh
      New Member
      • Nov 2006
      • 29

      #3
      thank you 4 ur reply

      but this is not possible for JavaScript . I mean JavaScript doesn't accept to write &lt; instead of <.
      do u see what i mean?
      cheers.

      Originally posted by dorinbogdan
      Welcome to TheScripts TSDN....

      Do not use <, >, && , replace them by the appropriate HTML symbol.

      Comment

      • dorinbogdan
        Recognized Expert Contributor
        • Feb 2007
        • 839

        #4
        Originally posted by elsheh
        thank you 4 ur reply

        but this is not possible for JavaScript . I mean JavaScript doesn't accept to write &lt; instead of <.
        do u see what i mean?
        cheers.
        Yes, I know, but the output html should convert those codes.
        Eventually try to not use the CDATA tag, and see if the html codes are parsed correctly.

        Comment

        Working...