Re: Newbie, HTML calling XSLT





Clive wrote:

   For an exercise, I would like to write a simple HTML page that calls
XSLT and passes it parameters.

   I know how to "accept" parameters into xslt and I have tested this
using Oxygen XML editor. It is the HTML to XSLT connection I don't
understand.

   Can this "link" be achieved with pure (X)HTML or do I need some
programming language like Perl or php to achieve this?

HTML is a markup language which allows to markup a document that is then usually rendered in a user agent.
HTML is not a programming language while XSLT is one.


In some user agents, lets call them desktop browsers, you can have script embedded in a HTML document executed in the browser and even fewer of those browsers also allow script to access an XSLT processor and run an XSLT transformation and then also allow to pass parameters to the XSLT processor before a transformation is performed.
So using client-side JavaScript in Mozilla 1.2, Firefox, and in IE 6/Win (or IE 5 and 5.5 Win if an XSLT processor like MSXML 3 or 4 is installed) you can indeed do client-side XSLT transformation, not with HTML alone of course, but with script embedded in a HTML document.


Client-side is one approach although as you can see with the restrictions on a few browsers not a reliable one. Server-side XSLT is another approach but that of course requires that the HTML document contains a form or at least a link to a server-side script where the XSLT transformation is performed. Parameters are then passed from the HTML document in the browser to the server as usual, in the query string of the URL requested or in the body of the HTTP request, the server side script reads out those parameters as usual and can then perform an XSLT transformation and send the result back to the browser.

So for server-side transformation you usually use a server-side programming language like PHP respectively a server-side framework like ASP or JSP to perform an XSLT transformation but for some servers there are XSLT filters or modules that allow the use of XSLT without needing to go down to a programming language.

--

	Martin Honnen
	http://JavaScript.FAQTs.com/
.



Relevant Pages

  • Re: XSLT in SQL Server 2005
    ... When you are doing the XSLT transformation directly in SQL Server 2005, ... can directly return HTML to the client. ...
    (microsoft.public.sqlserver.xml)
  • Re: What is pros/cons of using XSLT?
    ... Form "Cons". ... You can work with dynamic controls from code-behind in .NET ... I agree with CMM's points that generating the HTML from .NET code is more ... because XSLT is more indirect, there is some benefit to that too. ...
    (microsoft.public.dotnet.general)
  • Strange Exception using XSLT from NetBeans
    ... I have a strange problem in transforming an XML file in an HTML file ... the XSLT stylesheets and setting where to write the output HTML. ... I utilize NetBeans as editor and the strange fact is the if I set all ...
    (comp.lang.java.programmer)
  • Strange Exception using XSLT from NetBeans
    ... I have a strange problem in transforming an XML file in an HTML file ... the XSLT stylesheets and setting where to write the output HTML. ... I utilize NetBeans as editor and the strange fact is the if I set all ...
    (comp.lang.java.help)
  • Re: Displaying XML document in ASP.NET page using XSL Transform
    ... that's all your XSLT will ever do irrespective of the XSLT ... You need to either generate HTML (the preferred method of output for XSLT ... for some reason ASP.NET just sends all the XML data as one string on ... Hello, My Name is Joe. ...
    (microsoft.public.dotnet.framework.aspnet)

Loading