Results 1 to 6 of 6

Thread: RESOLVED: Insert stylesheet to existing XML

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    NY
    Posts
    497

    RESOLVED: Insert stylesheet to existing XML

    Anyone know how to insert a stylesheet instruction into an existing XML document with the DOMDocument model?

    Any other model?

    I need to insert something like:

    <?xml-stylesheet type="text/xsl" href="Display.xsl"?>

    into an existing XML document. It seems I can put this at the top of the doc and it works (when I do it using notepad).
    Last edited by vbmom; Apr 23rd, 2004 at 02:03 PM.
    end war
    stop greed

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    The document object should have a method called createProcessingInstruction.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    NY
    Posts
    497
    Gee that sounds like it's on the right track, but I haven't a clue how to use it. Particularly, I want to get that stylesheet line I mentioned:

    <?xml-stylesheet type="text/xsl" href="Display.xsl"?>

    Would you be able to tell me how to do it?
    end war
    stop greed

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    NY
    Posts
    497
    I see that you have to do something like:

    Set jP = jXML.createProcessingInstruction("type", "text/xsl")
    Call jXML.insertBefore(jP, jXML.childNodes(0))

    But it's what goes in the string and data portion of the createProcessingInstruction that I can't seem to figure. It doesn't like spaces either.
    end war
    stop greed

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I believe it's
    document.createProcessingInstruction("xml-stylesheet", 'type="text/xsl" href="Disaply.xsl"');
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    NY
    Posts
    497
    *thank you* that was it!
    end war
    stop greed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width