Including XSLT formatted XML files in an HTML page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cameron.MacNeil.024@gmail.com

    Including XSLT formatted XML files in an HTML page

    Hi folks, hopefully I posted this question in the right place.

    I'm currently writing an html file which references three different
    xml files, each one with its own xsl stylesheet. Originally I used
    framesets to display each file, and everything worked fine. However,
    this method produces an ugly page with too many scroll bars, and I
    want to simplify the look.

    I spent a good deal of time looking up ways to include html files
    within another, and I tried SSI with Apache 2.2. That method just
    displayed the xml elements on the page, and completely disregarded the
    stylesheets and formatting.

    I'm trying to use PHP right now, but I don't think that'll work either
    since I'm pretty sure you have to include other php files, rather than
    xml.

    All I want is for each styled xml file to be displayed one after the
    other on the page, without using frames where the height of each
    section is limited and therefore scroll bars are introduced if the xml
    docs are too long. Surely there must be some way to accomplish this?

    Thanks!
  • Andy Dingley

    #2
    Re: Including XSLT formatted XML files in an HTML page

    On 15 May, 15:51, Cameron.MacNeil ....@gmail.com wrote:
    All I want is for each styled xml file to be displayed one after the
    other on the page,
    Write some PHP code to do the XSLT translation yourself (three times),
    as you serve the page. Pretty standard stuff, so web searching should
    find you examples.

    Or else (assuming the XML doesn't change often) transform the XMLs to
    HTML fragments (no <headelement or <bodytags, just straight into
    the content). Store these on disk and include them through SSI. Re-run
    the XSLT generation process as necessary, when the XML changes.

    Comment

    • Rik Wasmus

      #3
      Re: Including XSLT formatted XML files in an HTML page

      On Thu, 15 May 2008 16:51:12 +0200, <Cameron.MacNei l.024@gmail.com wrote:
      Hi folks, hopefully I posted this question in the right place.
      >
      I'm currently writing an html file which references three different
      xml files, each one with its own xsl stylesheet. Originally I used
      framesets to display each file, and everything worked fine. However,
      this method produces an ugly page with too many scroll bars, and I
      want to simplify the look.
      >
      I spent a good deal of time looking up ways to include html files
      within another, and I tried SSI with Apache 2.2. That method just
      displayed the xml elements on the page, and completely disregarded the
      stylesheets and formatting.
      >
      I'm trying to use PHP right now, but I don't think that'll work either
      since I'm pretty sure you have to include other php files, rather than
      xml.
      When trying to use PHP, ask in comp.lang.php.

      As it's of topic here, I'll just say look at PHP's DOM
      (http://www.php.net/DOM), http://nl2.php.net/manual/en/book.dom.php,
      combined with the XSLT processor
      (http://nl2.php.net/manual/en/class.xsltprocessor.php, have a look at
      XSLTProcessor:: transformToDoc) , which probably will do what you want in an
      embarrasingly small amount of code.
      All I want is for each styled xml file to be displayed one after the
      other on the page, without using frames where the height of each
      section is limited and therefore scroll bars are introduced if the xml
      docs are too long. Surely there must be some way to accomplish this?
      That last part is just a CSS property of the container of course, using
      overflow:auto & max-height, ask in
      comp.infosystem s.www.authoring.stylesheets when in doubt.
      --
      Rik Wasmus
      ....spamrun finished

      Comment

      Working...