XSLT: Load XML or other text from external sources
Published:
Just discovered you can pull in external XML and other kinds of text directly through standard XSLT 2.0 methods. So here's a note to self on how.
Documentation
- W3
- Saxon:
Example usage
<!-- Single string URI -->
<copy-of select="doc('http://www.w3schools.com/xml/note.xml')"/>
<!-- One or more URI from items, in this case a variable -->
<variable name="uri" select="'http://www.w3schools.com/xml/note.xml'" />
<copy-of select="document($uri)" />
<!-- Unparsed text, in this case escaped HTML -->
<copy-of select="unparsed-text('http://example.com')"/>