Performance when reusing document () in xslt

Is it permissible to invoke the same document in the xslt file as follows:

<xsl:value-of select="document('doc.xml')/root/bar/foo1" />
<xsl:value-of select="document('doc.xml')/root/bar/foo2" />
<xsl:value-of select="document('doc.xml')/root/bar/foo3" />

...?

I can imagine that caching avoids the overhead of reading a file from time to time.

Or should I store doc.xm in a variable and use this variable for the query?

In this case, I will have to use some kind of library like xsle, since I am using xslt1.

Or is there another solution?

Note. Some parts of XPath must be dynamic, for example:

<xsl:value-of select="document('doc.xml')/root/*[name()=$lang]/foo3" />
+5
source share
2 answers

XSLT , () URL-, , count (document ('a.xml') | document ('a'xml') ) = 1. , , , . .

+2

, , , . MSXSL, , node .

, XSL- - , , , , , .

, , , , , .

+1

All Articles