Re-framing content with XFrames (2/2) - exploring XML | WebReference

Re-framing content with XFrames (2/2) - exploring XML

Re-framing content with XFrames

Populating a Frameset

An XFrames document is referenced by a URI of the form

http://example.org/home.frm#frames(id1=uri1,id2=uri2,...)
Each id identifies a frame element within the document with an id attribute with that value. Each associated URI is then assigned to that frame. If there is no frame with that id, the URI is ignored. If a frame within the document is not populated (because it has no id attribute, or because there is no parameter that uses its id), and it has a source attribute, the URI in that attribute is used instead. If an unpopulated frame has no source attribute, the frame is left blank. Relative parameter URIs are interpreted relative to the XFrames document, taking into account any xml:base value on the <frames> element. Having associated URIs to the frames, the XFrames document is displayed accordingly.

This process avoids most of the problems outlined at the beginning of the article by including the URLs of the sub-documents in the frameset URL. For example, in a document home.xfm, describing the following layout

 -------
| a |   |
|---| c |
| b |   |
 -------
<row>
    <column>
        <frame id="a"/>
        <frame id="b"/>
    </column>
    <frame id="c" source="main.xml"/>
</row>

and populated as follows

home.xfm#frames(a=1.xhtml,b=2.xhtml,c=3.xhtml)

the frames would be populated by assigning 1.xhtml to the frame with id="a", 2.xhtml to the frame with id="b", and 3.xhtml to the frame with id="c":

 -------
| 1 |   |
|---| 3 |
| 2 |   |
 -------

Populated as follows:

home.xfm#frames(a=one.xhtml,b=two.xhtml)

the frame with id="c" would be populated with main.xml. Populated as follows

home.xfm#frames(a=one.xhtml)

the frame with id="b" would additionally be left blank. Populated as follows:

home.xfm#frames(z=nav.xml)
the frames with id="a" and id="b" would be blank, and the frame with id="c" would be associated with main.xml (and nav.xml would be ignored).

Links and Targets

If a document assigned to a frame contains hyperlinks, and one of these is activated, then the URI of that hyperlink is normally assigned to the frame instead, and the XFrames document is redisplayed.This changes the URI associated with the frameset, by adding or replacing an association between the frame and the URI for the frame document; this would normally be visible to the user. If the frame containing the document does not have an id attribute, so that such an association is not possible, the entire frameset is replaced by the linked-to document.

If the hyperlink is in some way targetted (for instance by being associated with a target attribute in XHTML 1.0 ), then in the containing frameset a frame with an id equal to the target is located, and the URI is associated with that frame instead. If the current frameset contains no such id, but the frameset is associated with a frame in another frameset, then the process continues with that frameset, and so on. If no matching id is found, then the targetted resource is processed in an entirely new environment (for instance, a visual browser might open a new window).

Again, this process ensures that the frameset's URL contains all the sub-URLs to reconstruct all frames correctly.

Sizing, Styling and Rendering of Frames

All styling, positioning, and sizing of frames is done using a style sheet in CSS or some other suitable styling language. This means that there is nothing normative in the names <row> and <column> except a suggestion on how they should be rendered, and a default presentation in the absence of a stylesheet. If the <frames> element contains only <frame> elements (and no <row> and <column> elements), the default is to render them as tabbed or overlapping panes.

In the absence of height and width information from a style sheet, rows and columns are divided equally over the space available to them without regards to their content. Note that the stylesheet in an XFrames document has no effect on the contents of any frame.

Conclusion

XFrames tries to fix the problems associated with the frameset specification in HTML. We will have to wait and see at what rate the browser manufacturers will absorb all the innovations coming out of W3C, such as XFrames, XHTML 2.0 and XHTML+MathML+SVG profiles. After all, specifications are only as useful as the number of successful implementations they spark. For more details review the original XFrames specification, from which this document is derived.


Produced by Michael Claßen

URL: http://www.webreference.com/xml/column63/2.html
Created: Sep 02, 2002
Revised: Sep 02, 2002