Can i make an XSLT transformation directly in html page?
Question
I know namespace are used to describe, like doctype, but is there a way or a trick to transform inner namespace html with an xsl using xsd ?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:sample="sample-uri">
<head >
<title>Enter the title of your XHTML document here</title>
</head>
<body >
<p sample:node="retrieve-transformation">Enter the body text of your XHTML document here</p>
</html>
In other words i want to know if i can process xsl transformation to an xhtml page whithout using javascript.
Solution
Modern browsers support XSLT out of the box.
Take a look at eu.wowarmory.com - they use it extensively. If the server detects a user agent that does not support XSLT, it is rendered at the server side, and a quite verbose HTML is rendered there and sent to the browser.
This makes a nice abstraction if you plan to provide an XML webservice similar to the web site.
OTHER TIPS
In XHTML (i.e. application/xhtml+xml
—not text/html
!), you can trigger an XSLT program without JavaScript using the xml-stylesheet
processing instruction.
No, you cannot perform an XSL transformation without using some kind of scripting technology. I would suggest you do it serverside to save the client the trouble; and to avoid various issues if the transformation for some reason does not succeed on the client or runs slow.