Hi Mark, Mark Gannon schrieb am 06.09.2010 um 13:45 (-0700): > > I'm having difficulty getting the Document() function to work the way > I expect it. There are two main issues: > > i. Returning the whole document instead of a fragment > > When I try to load a document with a Fragment Identifier in the URL > such as : > > http://taxonomies.xbrl.us/us-gaap/2009/elts/us-gaap-2009-01-31.xsd#us- > gaap_EarningsPerShareDiluted > > It returns the whole document. In checking the XSLT spec > (http://www.w3.org/TR/xslt#document) I see the following statement: > If the URI reference does contain a fragment identifier, the function > returns a node- set containing the nodes in the tree identified by the > fragment identifier of the URI reference.
Your expectation is substantiated, but Xalan does not (yet) support this neat feature. Check out the following page: Xalan-J 2.7.1: document() function disregards URI fragment identifier http://marc.info/?l=xalan-j-users&m=123866295117812 > ii. Retrieving the same file for every Document() call > > Xalan doesn't appear to be caching the main document, but treating > each call with a relative URL as a request for a new document. With > this application (XBRL), the result is hundreds of requests for the > same large (1.3 Mb) file. > > Am I making a mistake here? Can't say as I haven't see the URLs you're calling. You could help Xalan by doing the call once and storing the node-set in a variable: <xsl:variable name="my-uri" select="'some/relative/path/to/doc.xml'"/> <xsl:variable name="my-doc" select="document( $my-uri )/*"/> Hope this helps. -- Michael Ludwig