XSLTProcessor: Do I need xml-stylesheet declaration?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • peridian
    New Member
    • Dec 2006
    • 72

    XSLTProcessor: Do I need xml-stylesheet declaration?

    Hi,

    I am using the XSLTProcessor object. Even though I use importStyleshee t, does my XML still need to specify the xml-stylesheet declaration?

    Code:
    $xsl = new DOMDocument;
    $xsl->load("myfile.xslt");
    
    $xslt = new XSLTProcessor;
    $xslt->importStylesheet($xsl);
    I only ask because currently my code seems to be ignoring the XSLT and churning out plain text, and this is the only thing missing.

    Regards,
    Rob.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Even though I use importStyleshee t, does my XML still need to specify the xml-stylesheet declaration?
    no. otherwise it may be that the UA/browser tries your already rendered (by PHP) XML to render once again.

    Comment

    • peridian
      New Member
      • Dec 2006
      • 72

      #3
      Interesting. If my stylesheet is broken into multiple files (using imports) would I have to load each of them in turn into the processor? Does the processor handle internal references to other stylesheets?

      Regards,
      Rob.

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        I don’t have experience with multiple stylesheets, but I’d say a split stylesheet wouldn’t work (you’re explicitly loading the stylesheet … so I guess the stylesheet references ain’t resolved) on the other hand side, if you have a DTD, it is read from the given location.

        Comment

        Working...