|
Home >Online Product Documentation >Table of Contents >Accessing XML Documents with XQuery Accessing XML Documents with XQueryThough XQuery is capable of handling mundane tasks like those described in the previous section, it is designed to access XML data. Right now, we will look at some simple queries that require an XML document as their input. For this purpose, we will use videos.xml, which is installed with Stylus Studio in the \examples\VideoCenter directory. You can also find a copy of this XML document on the Stylus Studio Web site.
XQuery allows you to access the file directly from either of these locations, using a suitable URL as an argument for its
To fetch this document from the Stylus Studio Web site, you would need a
(The latter Handling URLsURLs like those used in the previous example can be a bit unwieldy, but there are some shortcuts you can use.
l In Stylus Studio, you can specify the source document as the Main Input on the General tab of the Scenario Properties dialog box. Once you browse to the appropriate file and select it, you can refer to it in your XQuery code as simply " . " (dot).
l If you are working directly with a command line processor such as Saxon, you can copy the file locally (c:\xquery\videos.xml, for example) and work with it from that location. Once you have done this, you can use the command line option -s c:\xquery\videos.xml and again be able to refer to the input document in your XQuery code as " . " (dot).
The videos.xml DocumentThe videos.xml document contains a number of sections: video_template, actors, and videos. You might want to open this document in the XML Editor to get acquainted with it if you are not already familiar with it. |