xsl-list
[Top] [All Lists]

Re: [xsl] Difficulty with document() and for-each scope

2008-06-15 23:53:13
Adam Nielsen wrote:

Unfortunately when I do this I use document('') to pull the list of months from the XSLT code itself, but this then stops anything inside the for-each block from being able to pull any further data from the main XML code.

Does anyone know a way around this?

Yes. The de facto (?) way of pulling this trick is to use an anchor variable. Either you set document('')/me:month to a variable, or you set "/" to a variable (before you enter the for-each block). That way you either prevent the scope from shifting to another document (the first approach) or you keep a reference to the original input document (the second approach).

HTH,
Cheers,
-- Abel


--~------------------------------------------------------------------
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>
--~--