|
|
You probably know a lot about HTML pages created dynamically on the server and then served up to the browser - this is what ASP technology makes possible. A drawback with this is that the basic language is still HTML and you still use HTML to describe your data and the way it must be rendered. You should also know a lot about how XML lets you separate data and presentation. Why not then write dynamic XML Pages? That is, ASP pages that produce XML/XSL output to be read by an XML-compliant browser like IE5. If you think that this limits you and your users to having IE5 as the browser, then don't worry. I'll also demonstrate how you can have other browsers, such as Netscape Communicator, to manage them as pure HTML. What's your ultimate gain? You design and code your ASP pages (and possibly your Web site) using the more expressive XML instead of HTML. XML, XSL and ASP: What's Common?There's a subtle resemblance between XML/XSL and ASP/HTML. ASP is a template page based on HTML that contains expandable blocks of code. The parser analyzes them and sends out pure HTML code to the browser. This code has been generated on the fly and doesn’t belong to a static HTML page. On the other hand, XML is a generic and tagged description of a document. You can tie any of those tags to a certain block of HTML code with XSL. XSL is conceptually similar to ASP in the way that it takes an HTML-based template file and expands some tags reading input data from the associated XML document. The idea being that, since we have a browser like IE5 that understands pure XML and provides direct browsing functionality (XSL support) why not write ASP pages based on XML instead of HTML? If you can afford an XML-compliant browser then you have a double advantage: Ø You use the more expressive XML rather HTML to design your pages Ø You have dynamic XML pages. (I call these XSP, XML Server Pages) Using browsers that only understand HTML, you can still refer to XML-based ASP pages but you need to make the conversion from XML to HTML on the server. This is possible but makes the page less dynamic since you don’t have the result of ASP processing as a separate stream of bytes - the final XML page that ASP returns to the browser is never explicitly available to server-side XSL processing. However, passing from ASP also lets you use static XML pages with Netscape and IE4. The XSL is applied in the background using the IE5 XML object model assuming, of course, that the required IE5 components are present on the server. Using XML Through the WebThe combination XML+XSL+ASP is particularly useful for small applications built around a certain data type. You could design an XML-based language to manage those objects (objects taken from the domain of the problem, for example car descriptions, car information queries). This language can be identified by a DTD document. Next, the XSL tells the browser how to manage those customized tags to produce HTML and actually display the document. Notice that at this point, you have a logical, well-formed set of tags for your domain. Any file compatible with that grammar can be displayed using a specific template. If you need a completely different view, you don’t need to change the XML descriptive data, but just the template. This may remind you of the MFC and SmallTalk document/view model. The ExampleYou can write ASP pages using XML instead of HTML tags very easily: simply change the XML file extension to ASP and move it to a directory on your Web server. Since now the XML source code is an ASP page, you can add ASP <%…%> blocks within it. Be aware, of course, that the final output is XML-compliant. For example, this is a perfectly valid code: <COVER title=<%=Request("Title")%> subtitle="What Every Web Developer Needs to Know"> </COVER> and nothing prevents you from navigating to a URL like this: http://expoware/xml/mind0399.asp?Title="Win2K" Supporting Other BrowsersSince ASP is server-side technology, you might think that the hard work is over, and that any browser can now support XML direct browsing! Unfortunately, this is untrue. DTD validation and direct browsing are steps that take place on the client side, so even if you've been able to create dynamic XML files, you'll still need a browser capable of XSL processing, and today, the only browser that's capable of this is IE 5.0. However, just the possibility of using ASP code as well as the presence of a powerful XML object model is an exciting prospect. To get around the problem of compatibility, you should write your XML-based ASP pages with a special heading that can work around the browser's differences: <% uAgent = Request.ServerVariables("HTTP_USER_AGENT") if Instr(uAgent, "MSIE 5.0") <= 0 then ' 1. Transform XML code into HTML exploiting any XML ' engine on the server that knows how to handle XSL. ' (e.g. IE5) ' 2. Response.Write the HTML code produced Response.End end if %> This is not a definitive solution since it forces you to return to <%…%> code. While this is a significant loss, you can still use XML to design the pages. In this way, browsers such as Netscape can understand XML, but only as static pages. |
|
|
|
|
|
| |
chicago web site design spfxmasks Host Department NOLIMIT Web Hosting .co.uk Domain Names Gucci sunglasses NY Pool Contractor answering service conference calling swimming pool builder MSN sunglasses |
Email TopXML
|
|
Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP |