Hi, Nicholas. Nicholas W <4...@log1.net> wrote on 01/19/2010 03:29:32 AM: > I am trying to use a lookup embeded in the xslt source according to > the tips on this page: > > http://www.ibm.com/developerworks/xml/library/x-xsltip.html > > > I am creating an XSL transformer like this: > > TransformerFactory transformerFactory = TransformerFactory > .newInstance(); > transformerFactory.setAttribute("indent-number", new Integer(2)); > Transformer trans = transformerFactory.newTransformer(sheetSource); > > And in my document I have something like this: > > > <xsl:variable name="langs-top" select="document('')/*/l:languagecodes"/> > > > However I cannot seem to get this to work, it seems that the langs-top > variable is always empty. Even if I do something like this:
What you're trying to do works ordinarily, but there are some things that can go wrong. The zero-length string that you're supplying as a URI reference to the document function is supposed to be resolved against the base URI from the stylesheet, and the resource identified by the resultant URI is loaded using the document function. Usually that process will yield the URI of the stylesheet, but if the base URI from the stylesheet is not available for some reason, or it isn't actually the same as the URI for the stylesheet itself, the document function might not be able to retrieve the stylesheet that way. What kind of object is sheetSource? If it's a DOMSource or SAXSource, you might need to use the Source.setSystemId(String) method to supply the URI of the stylesheet document. If it is a StreamSource, how did you construct it? Depending on which StreamSource constructor you use, the system ID might not be available to the XSLT processor Thanks, Henry ------------------------------------------------------------------ Henry Zongaro XML Transformation & Query Development IBM Canada Lab T/L 313-6044; Phone +1 905 413-6044 mailto:zong...@ca.ibm.com