I'm having major problems! I have an XML document that I wish to render in WML and HTML, using PHP. I have written the XSL stylesheet for bother WML and HTML but I'm not sure how to use PHP to use XSL with XML to create the HTML or WML.

Any ideas???

Thanks,

Duncan...

    • [deleted]

    php, xml, xsl, html, wml... What happened to the good old days where there was just html and PERL...

    What are you trying to achieve?

      Vincent,

      I'm trying to build a real-time university faculty timetable system that is accessible on desktops and handhelds. I'm using XSL to render the XML into WML and HTML. Due the limitations of mobile WAP broweser (can't read stylesheets and render pages client side) the page need to be generated server side, that's where PHP comes in!

      Duncan...

        • [deleted]

        So why don't you just use PHP to write HTML and WML?

          I'm doing the porject as part of my Masters dissertation and my tutor was pushing me toward using XML and XSL. By using these technologies give me any advantage over using plain old PHP?

            • [deleted]

            XML and XSL are not really standards. Some poeple say they are, but
            if the description contains "extensible" and you can expand it yourself, it's not a standard.

            Basically neither XML nor XSL do anything that you can't do with HTML.
            XML and XSL just let you use user-defined shortcuts, something we've all been using since the good old days of PERL.

            And now we have PHP instead of PERL.
            A well-programmed function library/class will do you more good than XML/XSL.
            Think of templates etc.

            In the end it's all HTML anyway :-)

              I have done a similar thing for my 'in house' website, using XML to store the data in a locically marked up way (and this is just data, no programming code or stylesheets etc.)

              I then use a standard PHP script to pick up that xml file from the REQUEST_URI and render it appropriately using xsl and the xslt library.

              Some things to note:

              I am doing this on Linux and rebuilt apache/PHP to have XML support with Sablotron 0.51. This is still a bit broken in the way it parses the XML (a fault of xpat?) but with a bit of patience these bits can be worked around.

              Specifically the XSL file cannot contain attributes in the non xsl tags, one needs to declare them all separately.
              and there was an issue with reading the XML header line that was something to do with having an element immediately after it on the line (I don't remember exactly how it was resolved but it bugged me for a while).

              In short - it sounds ideal for your project. Nice clean layers to separate data, layout and the code to manipulate it.

              I am now moving a lot of documentation/config files to XML as parsing it with xsl seems pretty easy to generate both end user docs and admin docs from the same files. ( a principle of write things only once, then there is no sync problem).

              ..d

                vincent wrote:

                XML and XSL are not really standards. Some poeple say they are, but

                if the description contains "extensible" and you can expand it yourself, it's not a standard.


                It is a standard and when the tools behave correctly it works fine.


                Basically neither XML nor XSL do anything that you can't do with HTML.

                XML and XSL just let you use user-defined shortcuts, something we've all been using since the good old days of PERL.


                It sounds like you are arguing from a position of ignorance. Having a standard human readable way of representing data with clear tools to manipulate/select it is much better than having to hack yet another slight variation on a perl text parser.


                And now we have PHP instead of PERL.

                A well-programmed function library/class will do you more good than XML/XSL.

                Think of templates etc.


                I am thinking of templates, that is why I use XML instead of yet another non-standard file format that requires me to reinvent the wheel yet again.

                XML comes with the appropriate parsers and manipulation tools so one doesn't have to rewrite it. It is far more generalised and has a great utility when one wants some form of structured data that can be validated.

                Of course it isn't the only way to do things but it is quicker and far nicer than many other ways.

                For instance, when I need to put up a new page on my web site I write with logical tags that describe the content and have strict bounds on the structure. This data file can then be transformed in many ways using different XSL schema. I don't need to touch the program code to modify the page, just the schema that describes how the page should be represented (even to the per IP number level if I want). Yes it could be done with Perl (which I use extensively) but I have found the XML approach to be cleaner, neater, and quicker.


                In the end it's all HTML anyway :-)


                You couldn't be further from the truth..

                ..d

                  • [deleted]

                  <manuell>
                  I know nooothing...
                  </manuel>

                    Write a Reply...