xsl-list
[Top] [All Lists]

RE: [xsl] Use of xsl:document

2006-06-22 04:27:18
I wish to store an external XML file as the value of an XSLT 
variable using XSLT 2.0. This is how it is presently being acheived:

<xsl:variable name="Xml" as="document-node()" 
select="document('test.xml')"/>

That's the correct way to do it.

Should I be using the xsl:document function instead?
If I should, why?
Is there any use for the xsl:document function other than the 
fact it allows validation?

xsl:document is an instruction, not a function. It allows you to construct a
document within the stylesheet, rather than reading an external file such as
text.xml.

You can construct a document implicitly using

<xsl:variable name="x">
  <test>
     <data/>
  </test>
</xsl:variable>

Using xsl:document makes this more explicit and provides access to extra
functionality such as validation.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>