Convert an XML file to a Web page

With Microsoft Office SharePoint Server 2007, you can easily create and publish Web pages directly in a Web browser. In addition, you can create Web pages directly from existing XML files, which makes it easier to publish and share that content with others on your team, your company, or anyone on the Web.

In this article


Advantages of converting XML files to Web pages

There are a number of advantages to converting XML files into Web pages for your site:

  • Faster and easier creation     If you have a number of data sources that can output XML, and you have XSL stylesheets containing the schema and HTML output, you can quickly and conveniently turn those XML files into Web pages.
  • Single-sourced content     You can use just one document for multiple uses, instead of creating one version for your team in XML and another version for the company in HTML. Here, the two are linked.
  • Offline work     By using an XML file to create a Web page, you are free to work on the content with or without a connection to the Internet.
  • Web site integration     When you convert an XML file into a Web page, you can seamlessly display that page as part of a larger Web site. As a result, readers may not even realize that the content originated as an XML file because it appears as a natural part of the Web site.
  • Document sharing     When you convert an XML file into a Web page, that authored content can be easily shared with others who may not be able to view XML files.

Top of Page Top of Page

Considerations when converting XML files to Web pages

Keep the following in mind when you convert XML files into Web pages:

You can see how your XML file might appear before and after conversion in the following pictures. The red line highlights the contents of the document.

Sample XML employee list in Notepad

Original XML file in Notepad

Sample XML employee list converted into a Web page in Office SharePoint Server 2007

Converted Web page as it appears in the browser after conversion

 Note   This example illustrates a relatively simple XML file with tabular data only. Typically, you would use a more complex XML file containing a rich set of data presented in a readable format as a Web page.

Top of Page Top of Page

Upload an XML file to a document library

To convert an XML file to a Web page, the XML file must first reside in a document library (document library: A folder where a collection of files is stored and the files often use the same template. Each file in a library is associated with user-defined information that is displayed in the content listing for that library.) in an Office SharePoint Server 2007 site. To add an XML file to a document library, browse to the library where you want to add the XML file, and then click Upload on the menu bar. For more information, see the article Add one or more files to a library.

 Note   In addition to uploading your XML file, your site owner must upload an associated XSL stylesheet (.xsl file) and configure it for XML conversions — for more information, see the article Configure document-to-page converters. This XSL stylesheet resides in a document library in the top-level site.

Top of Page Top of Page

Convert an XML file to a Web page

  1. Open the document library that contains the XML file that you want to convert to a Web page.
  2. Point to the file name of the XML file that you want to convert, click the arrow that appears, and then point to Convert Document.

Convert Document command in Office SharePoint Server 2007

 Note   If you don’t see this option, the document conversion feature may be disabled or an associated XSL stylesheet may not be configured. Contact the site owner for assistance.

  1. Click From XML to Web Page.

 Note   You may also see the option From InfoPath Form to Web Page. This option appears because Microsoft Office InfoPath 2007 forms are written in XML as well. Unless instructed by your site owner, you should not use this option for converting XML files because they require different conversion settings from Office InfoPath 2007 forms.

The Create Page From Document page opens. Depending on how your site was set up, you may see all of the options or just a portion of the options described below.

Create Page From Document page in Office SharePoint Server 2007

  1. In the Location section, click Browse, and then select the site where the page is to be created.

The site that you select must have publishing turned on. If you receive a message that publishing is not enabled on your site, contact the site owner.

 Note   If instead of the Location and Page Title and Description sections, you see Existing Page with the option to update an existing page, this means the XML file was already converted. For information on updating existing Web pages, see the later section Update the XML file and the Web page. To ignore the existing page and create a new one, clear the Update existing page check box and continue with the following steps.

  1. In the Page Title and Description section, enter a title, description, and URL (file name) for the Web page that you are creating.

The URL name must be unique and may not contain special characters (#,%,&, etc.). If you use spaces, they are removed automatically when the page is created.

 Note   The title appears above the new Web page, in the Web browser title bar (the HTML title tag), and in the item's properties in the document library. The description appears only in the item's properties in the document library. The URL appears in the Web browser address bar (followed by the .aspx extension).

  1. In the Processing section, you may have the option to create the page immediately or to create the page in the background.

Do one of the following:

  • To start the conversion process right away, click Create this page for me now, and take me to the page when it is created. You are taken to a long-running operations (LRO) page until the conversion is complete. This process usually takes under a minute but may take longer depending on the conversion queue and your conversion settings.
  • To start the conversion process in the background, click Create this page for me in the background, and take me back to the document library. You return to the document library where your XML file resides.
  1. If you have the option to send the created page to others, select the Send e-mail to the following users when the page is created check box, and then enter the names of users whom you want to notify in the Users box.
  2. Click Create to convert the XML file.

Options for the newly created Web page

If you choose to create the Web page right away, you are taken to the new page when the conversion is completed. On the toolbar at the top of that page, you see several options, as shown here.

Web page toolbar in Office SharePoint Server 2007

From here, you can do one the following:

You may see even more options depending on how your site was set up by the site owner.

Top of Page Top of Page

Updating the XML file and the Web page

When you convert an XML file into a Web page, you end up with two files in Office SharePoint Server 2007: the XML file and the Web page. Each file has its own URL, versioning, history, workflow, and so on (assuming those features are enabled for that particular content type or document library).

At the same time, the two files remain linked. When you edit the XML file and save it to a document library, you can then re-generate the Web page from the XML file. This loose coupling allows you to focus on content creation in XML while at the same time delivering a version that is formatted for the Web.

To allow the maximum flexibility, Office SharePoint Server 2007 provides a number of ways for you to update the XML file, the Web page, or both. These options are explained here.

Update the XML file but not the Web page

There are two ways to update the XML file after it has been converted to a Web page.

Update the XML file from the document library

  1. Browse to the document library that contains your XML file.
  2. To check out the XML file, point to the file name, click the arrow that appears, and then click Check Out. Checking out the XML file is not required, but it is a good practice to preserve versions of the file. It also prevents other users from making changes to the XML file while you edit it.
  3. To edit the XML file, point to the file name, click the arrow that appears, and then click Edit Document.
  4. Edit the file, save the file, and then close your XML editor. Check in the file by using the drop-down menu of the file in the library.

Update the XML file by using the Web page toolbar

  1. Browse to the Web page that was generated from the XML file. Typically, you find the Web page in the Pages library of the site where you chose to create the page.
  2. Click Edit Page on the authoring toolbar. The page opens for editing.
  3. In the Page Content field control, click Open Source Document. You are prompted to confirm that you want to check out and edit the XML file.
  4. Click OK to open your XML file.
  5. Edit the file, save the file, and then close your XML editor. Check in the file by using the drop-down menu of the file in the library.

Update the Web page but not the XML file

 Note   You should exercise caution when updating the Web page by itself because your changes will be lost if you choose to update the page from the XML file again in the future.

  1. Browse to the Web page that was generated from the XML file. Typically, you find the Web page in the Pages library of the site where you chose to create the page.
  2. Click Edit Page on the authoring toolbar. The page opens for editing.
  3. In the Page Content field control, click Edit Content.

The HTML Editor toolbar appears directly above the page content. For more information about using the HTML Editor, see the article Use the HTML Editor.

Update the Web page with changes made to the XML file

There are two ways to update the Web page with changes made to the XML file.

 Note   Before the Web page can be updated with changes made to the XML file, the Web page must be checked in. You may need to perform this step separately.

Re-convert the XML file

  1. Follow the same steps that you performed earlier to convert your XML file to a Web page — see the earlier section Convert an XML file to a Web page.
  2. This time, on the Create Page From Document page, leave the Update existing page check box selected.
  3. Click Create to update the Web page with changes made to the XML file.

Update the Web page by using the Web page toolbar

  1. Browse to the Web page that was generated from the XML file. Typically, you find the Web page in the Pages library of the site where you chose to create the page.
  2. Click Edit Page on the authoring toolbar. The page opens for editing.
  3. In the Page Content field control, click Update Content from Source.
  4. When prompted to confirm, click OK to update the Web page.

Top of Page Top of Page

 
 
Applies to:
SharePoint Server 2007