27. xsl:result-document in SaxonJS
You’ve seen xsl:result-document in a few of the exercises, but it’s
time we explained what’s going on.
The
xsl:result-documentinstruction is used to create a secondary result.SaxonJS leverages this to produce results “on” the browser’s web page.
If the
hrefattribute begins with “#”, for example#main, SaxonJS will put the secondary result in the web page element with the corresponding id, “main” in this case.By default, the secondary result is appended to the end of the content on the web page.
If you specify the
method, “ixsl:replace-content”, it will replace the entire contents. (You can specifyixsl:append-contentexplicitly, if you wish.)