the information so that it’s easier to read. You can also use XSLT to limit the
amount of information that you see. XSLT transforms XML into something
usable.
Note that you might see two definitions for XSLT: eXtensible
Style
Language
Transformation and eXtensible
Stylesheet
Language Transformations. Both
definitions refer to the same technology. I prefer
the second form because it
better describes how XSLT works.
This section describes how you can use XSLT to change the way that the
output from your applications looks. After you save your document as XML,
you can present it on a Web site for someone else to see. XSLT can transform
the XML into HTML so that other people can enjoy your work.
XSLT can perform other kinds of transformations, so don’t
limit yourself to
the techniques that you see demonstrated in this chapter. For example, you
can use XSLT to create another XML document or even a text file. XSLT is all
about transforming your data into the form that you want rather than forcing
you to accept data in a less-than-optimal form. There’s an excellent XSL tutor-
ial at
http://www.w3schools.com/xsl/default.asp
.
You can also find
a good XSLT reference at
http://www.zvon.org/xxl/XSLTreference/
Output/index.html
.
Saving your Word document by using XSLT
You can use XSLT to work with any XML file generated by an Office applica-
tion — even the WordML documents created by default with Word (see the ear-
lier “Comparing WordML with Saved XML” section for details). When you use
the Save As dialog box (refer to Figure 11-3)
to save a Word document as XML,
you can choose to use an XSLT file to modify the output. (Although this chapter
provides enough information about XSLT to work with the examples,
XSLT For
Dummies,
by Richard Wagner, provides additional insights that you might find
helpful.) You might want only the document information
or only the document
content. It’s even possible to build a list of all the fonts used in every Word doc-
ument on your machine. Any information that WordML provides is available.
The example in this section helps you overcome one of the problems with the
output options provided with Word. By using XSLT, you can create an HTML
page containing any information about your document. (Even
though the XML
Paper Specification, or XPS, file format creates a Web page for your document,
it creates an exact replica of the file and doesn’t present just the data you want
the viewer to see.) This example shows document information,
but the tech-
nique works with fonts, options, or the content of the file as well. The main
reason I chose document information is that this particular technique works
well if you want to create a Web site with a listing of all the documents that
you’ve created. Using this technique creates a searchable Web site that’s infi-
nitely easier to mine for data than using the Word documents directly.
250
Do'stlaringiz bilan baham: