Re: [xsl] AltovaXML and fragment identifier

Subject: Re: [xsl] AltovaXML and fragment identifier
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Tue, 31 Mar 2009 16:34:46 +0200
David Carlisle schrieb:
I wrote

, however a system is allowed to reject any URI at all and if it
chooses to reject all uri with fragids passed to doc() or document()
it can do that, but it should raise [err:FODC0005].

which is false. It's true for doc() (which was what I was reading) but for document() the spec explictly says that the fragment identifier should be stripped off and used after retrieval.

So

document('test2009031701.xml#f1')

is the same as

document('test2009031701.xml')/id('f1')

or an error, depending on various factors....

The latter syntax is XSLT 2.0, but the former is very useful syntactic sugar for 1.0, because it allows to pull a node-set from a secondary document based on an ID type attribute without creating a result tree fragment.

I couldn't find that nice behaviour prescribed by the spec for XSLT 1.0,
but Saxon 6.5 and LibXSLT 1.1.24 implement it. (Xalan 2.7.1 doesn't, and
MSXML 4.0 and 6.0 don't seem to. And AltovaXML Version 2008 rel. 2 sp2
throws an error, which caused this thread.) The spec for 1.0 says:

  If the URI reference does not contain a fragment identifier, then a
  node-set containing just the root node of the document is returned. 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. The semantics of the
  fragment identifier is dependent on the media type of the result of
  retrieving the URI.
  -- http://www.w3.org/TR/1999/REC-xslt-19991116#document

"The nodes in the tree identified by the fragment identifier of the URI
reference." Okay, it makes sense to take this to mean a call to the id()
function.

If this nice behaviour is mandatory in 2.0, could you provide a pointer
to the part of the spec saying so? (I couldn't find it.)

Michael Ludwig

Current Thread