Subject: Re: [xsl] Storing XML doc refs in variables From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 30 Jan 2007 17:27:18 GMT |
> (since I don't want to load the document every time I need to access the > data inside). actually even if you do use document() or doc() more than once teh spec guarantees that the result is stable, so in practice most systems cache the result and don't actually fetch the document twice, as if they do fetch it twice and it has changed in the interim, the system is nob-conformant. > The theory was that if styles.xml didn't exist, an empty document node > would be created and assigned to the variable, meaning any future use > would simple return an empty results set. An xsl:variable with content but no as= attribute always geneartes a document node, so your otherwise branch is not needed, but your when branch is bad, as it will generate a _copy_ rather than a reference to, your document. Also as you have used value-of rather than copy-of or sequence, you are just getting the string value of the document. try <xsl:variable name="styleXMLDoc" select=" if(doc-available('styles.xml')) then doc('styles.xml') else ()"/> David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Storing XML doc refs in varia, Rick Livesey | Thread | [xsl] Duplicate Nodes in XSL and tr, Punnoose, Roshan |
Re: [xsl] Wrap changing element seq, Yves Forkl | Date | Re: [xsl] Wrap changing element seq, David Carlisle |
Month |