[Home] [By Thread] [By Date] [Recent Entries]


Magnus Henriksson (MO/EAB) wrote:
> If run document.xml through an XInclude processor, I get the
> following result:
> 
> <?xml version="1.0"?>
> <document xmlbase="http://example.com"
>           xmlns:xi="http://www.w3.org/2001/XInclude" >
>   <paragraph>How to handle customers:</paragraph>
>   <list xmlns:xlink="http://www.w3.org/1999/xlink"
>         xml:base="common/policy.xml">
>     <item xml:id="item1">The customer is always right.</item>
>     <item>When the customer is wrong, see <link xlink:type="simple"
>                                                 xlink:href="#item1"/>.</item>
>     <graphic xlink:type="simple"
>              xlink:actuate="onLoad"
>              xlink:show="embed"
>              xlink:href="../images/happy-customer.gif"/>
>   </list>
> </document> 
>
> My problem is that the link points to
> http://example.com/common/policy.xml#item1, but I really want it to
> point to #item1 in the XIncluded result.

Those two things are the same in this case. Let me quote the relevant 
part from http://www.apps.ietf.org/rfc/rfc3986.html#sec-4.4

"When a URI reference refers to a URI that is, aside from its fragment 
component (if any), identical to the base URI (Section 5.1), that 
reference is called a "same-document" reference. The most frequent 
examples of same-document references are relative references that are 
empty or include only the number sign ("#") separator followed by a 
fragment identifier.

When a same-document reference is dereferenced for a retrieval action, 
the target of that reference is defined to be within the same entity 
(representation, document, or message) as the reference; therefore, a 
dereference should not result in a new retrieval action."

Because http://example.com/common/policy.xml is the base URI, 
http://example.com/common/policy.xml#item1 is a same-document reference, 
and therefore "points" to the XIncluded result.

-- 
Sjoerd Visscher
http://w3future.com/weblog/

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member