7 messages in com.mulberrytech.lists.xsl-listRe: [xsl] AltovaXML and fragment iden...
FromSent OnAttachments
Martin HonnenMar 17, 2009 8:14 am 
David CarlisleMar 17, 2009 9:23 am 
Michael KayMar 17, 2009 9:34 am 
David CarlisleMar 17, 2009 9:37 am 
Michael LudwigMar 31, 2009 7:34 am 
David CarlisleMar 31, 2009 7:45 am 
Michael LudwigMar 31, 2009 9:27 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [xsl] AltovaXML and fragment identifierActions
From:Michael Ludwig (ml@as-guides.com)
Date:Mar 31, 2009 7:34:23 am
List:com.mulberrytech.lists.xsl-list

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.)