Administration > Stylesheets > Displaying XML Documents in a Web Browser
  
Displaying XML Documents in a Web Browser
You can add a stylesheet association processing instruction to an XML document that specifies a stylesheet for a web browser to use when displaying it.
To display an XML document in a web browser:
1. You must first decide whether or not your XML document needs to reference a document type declaration (DTD). Browsers don't generally need one to display your document properly.
Choose one of the following approaches:
If you do not want to reference a DTD, you will need to write out a version of your document that can be displayed by a browser using the write command:
write -noheader -flatten both -nonasciichar numref filename.xml
Make sure that this version of your document is open and then proceed to the next step.
If you decide to reference a DTD, your document must refer to it in a way that a browser can use.
The most efficient way is to save the DTD and document in the same directory. When you save your document, Arbortext Editor writes a DOCTYPE declaration that enables browsers to successfully locate the DTD. Proceed to step two.
The DTD and document can be saved in different directories, but they must be on the same web server. In this case, use the write command to write out your document with the -sysid modifier. For example:
write -sysid "http://www.some_site.com/doctypes
/axdocbook/axdocbook.dtd" filename.xml
The system ID can also be a relative URI, for example:
write -sysid "../../doctypes/axdocbook
/axdocbook.dtd" filename.xml
* 
If your stylesheet or DTD contains any entity references, the entities must be located on the same web server and they must be referenced using relative paths or URLs.
Make sure that this version of your document is open and proceed to the next step.
2. Make sure the stylesheet is located on the same web server as your document. We recommend that you save the stylesheet in the same directory as the document.
3. Use Arbortext Editor to open the document to which you want to add the stylesheet association.
4. ChooseFormat > Select Stylesheets to open the Select Stylesheet dialog box.
5. Highlight HTML File in the Selected for list and click the Modify button.
6. In the Modify HTML File Stylesheet Selection dialog box, you'll see a list of all of the available stylesheets for producing HTML output. The stylesheets are either locally available or offered by Arbortext Publishing Engine (Arbortext Publishing Engine stylesheets have a (pe) notation). Choose a stylesheet based on the following considerations:
If the stylesheet is located in the document directory, the stylesheet association will be written with a relative URI that is just the stylesheet's file name.
If the stylesheet is located in the document type directory, select it from the list displayed in the Modify HTML File Stylesheet Selection dialog box.
The stylesheet association href will still use a relative URI containing the stylesheet file name (for example, href="mydoctype.xsl").
If the document must have a relative path reference to the stylesheet, you need to save your document in Arbortext Editor, close it, and open your document in a text editor. Change the href of your stylesheet association to an accurate relative path, for example:
href="../../doctypes/mydoctype/mydoctype.xsl"
You can select the stylesheet using the Browse button. This causes the stylesheet association href to use an absolute path file-scheme URL. For example,
href="file:///N:/webserver/doctypes/mydoctype/mydoctype.xsl"
After you save your document, open your document in a text editor, and change the href of your stylesheet association to a path that is relative to the document, for example:
href="../../doctypes/mydoctype/mydoctype.xsl").
You can also specify a URL by entering it in the file name field displayed in the dialog box from the Browse button. The stylesheet association will look like the following:
href="http://myserver:8080/pe/axdocbook.style"
7. Click the Add association button.
To remove a stylesheet association, you can highlight a stylesheet with an association and click Delete association.
8. Click OK to apply your choices and close the Modify Stylesheet Selection dialog box.
9. Click Close in the Select Stylesheets dialog box to return to the document.
10. You must save your document for the stylesheet association to take effect.