Any XSL/XSLT Gurus out there?

Discussion in 'XML & RSS' started by Lever, Jan 23, 2007.

  1. #1
    XML to HTML/XHTML via XSL/XSLT seems simple enough but are there any XSL/XSLT gurus out there who know how to handle complex XML docs? I need some tips/advice/pointers please.

    Any help greatly appreciated :)
     
    Lever, Jan 23, 2007 IP
  2. edr

    edr Guest

    Messages:
    784
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can you ask your question here in the forum? You might get a better response to a direct question.
     
    edr, Jan 23, 2007 IP
  3. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Usually complex XML documents are managed by complex XPath expressions. :D
    And sometimes with multipass processing.
     
    ajsa52, Jan 23, 2007 IP
  4. Lever

    Lever Deep Thought

    Messages:
    1,823
    Likes Received:
    94
    Best Answers:
    0
    Trophy Points:
    145
    #4
    Well the initial question in the title was "are there any XML/XSLT gurus out there?" And I've got two potential gurus so far :)

    LOL Well now I'm gonna have to work out how to uncomplex this and find out what XPath is and if it's of any use to this situ...

    I have a fairly complex XML doc and no XSLT for it. The XML, needs to be pulled off a 3rd party server and eventually end up being displayed as HTML/XHTML in a CMS, so I'm thinking that the XML needs to be transformed into HTML/XHTML and somehow inserted into the MySQL DB of the eventual site.

    Can this be done on an automatic basis so the content is always fresh, has it been done, are there any examples of this method in practice, how tricky is it, what are the implications of doing this and what might I need to look out for?

    Any help & advice greatly appreciated :)
     
    Lever, Jan 26, 2007 IP
  5. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #5
    I have a site which content is created online with XSLT transformations
    I use local XMLs and external XMLs obtained via web services (with authentication or not), and local XSLs files.
    The transformation is made with "xsltproc" (unix program) inside a simple perl program.

    With huge sites I don't recommend store the XHTML obtained on database, unless your site is on a slow server.
    And, to gain speed you can store the external XMLs on your filesystem, with weekly updates, for example.

    Example of using "xsltproc" on PERL:

    
    my $file_xml = "http://www.yourprovider.net/rss_news.php?query=george+bush";
    my $file_xsl = "../xsl/news.xsl";
    my $mypage = 2;
    my $mylang = "en";
    print qq[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n];
    print `xsltproc --param p_page "'$mypage'" --param p_lang "'$mylang'" "$fich_xsl" "$fich_xml"`;
    
    Code (markup):
     
    ajsa52, Jan 31, 2007 IP