Chapter 8. Combining Documents
One of XSLT’s most powerful features is the document() function, which lets you combine
documents. You can use parts of a document (specified with XPath
expressions, of course) to identify other documents. You can then open
those documents and perform stylesheet functions on the combination of
those documents. In this chapter, we’ll cover the document() function in all its glory.
[2.0] XSLT 2.0 and XPath 2.0 provide three new
functions for combining documents: doc(), collection(), and unparsed-text(). The doc() function, defined by XPath 2.0, is
similar to the document() function,
though less powerful. The collection() function, also defined by XPath
2.0, allows us to add collections of nodes provided by an XSLT processor.
The kinds of nodes provided can vary from one processor to the next.
Finally, the unparsed-text()
function lets us add raw text to the data we’re processing in our
stylesheet. When combined with features such as tokenization and regular
expressions, unparsed-text() gives
us many new ways of manipulating data. We’ll look at these new functions
at the end of this chapter.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access