Below you find an example of how future markup and linking
may be written:
1. links.xml
Code:
<?xml version="1.0"?>
<links xmlns:xlink="http://www.w3org/1999/xlink/namespace/">
<link xlink:type="extended" xlink:role="product-manufacturer">
<loc xlink:type="locator"
xlink:href="products.xml#xpointer(id('23428'))"
xlink:label="item"/>
<loc xlink:type="locator"
xlink:href="manufacturers.xml#xpointer(id(ABC))"
xlink:label="madeby"/>
<go xlink:type="arc"
xlink:from="item"
xlink:to="madeby"/>
</link>
<link xlink:type="extended" xlink:role="similar-products">
<loc xlink:type="locator"
xlink:href="products.xml#xpointer(id('23428'))"/>
<loc xlink:type="locator"
xlink:href="products.xml#xpointer(id('75386'))"/>
<loc xlink:type="locator"
xlink:href="products.xml#xpointer(id('11111'))"/>
</link>
<link xlink:type="extended" xlink:role="similar-products">
<loc xlink:type="locator"
xlink:href="products.xml#xpointer(id('99999'))"/>
<loc xlink:type="locator"
xlink:href="products.xml#xpointer(id('11111'))"/>
</link>
</links>
2. Manufacturers.xml
Code:
<?xml version="1.0"?>
<mcatalog>
<manufacturer id='ABC'>
<title>ABC</title>
<description>ABC Ltd.</description>
</manufacturer>
<manufacturer id='XYZ'>
<title>XYZ</title>
<description>XYZ Ltd</description>
</manufacturer>
<manufacturer id='QRS'>
<title>QRS</title>
<description>QRS Ltd</description>
</manufacturer>
</mcatalog>
3. Products.xml
Code:
<?xml version="1.0"?>
<catalog>
<product id='23428'>
<title>ABC Microwave Oven - Model 34X</title>
<description>Great oven!</description>
</product>
<product id='75386'>
<title>XYZ Microwave Oven - Model TRL7</title>
<description>Even a better model!</description>
</product>
<product id='11111'>
<title>QRS Microwave Oven - Model SDF</title>
<description>The ultimate in oven construction!</description>
</product>
<product id='99999'>
<title>QRS convention Oven - Model LKJG</title>
<description>You won't believe how good this oven is!</description>
</product>
</catalog>
4. Products.xsl
Code:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3org/1999/XSL/Transform"
xmlns:xlink="http://www.w3org/1999/xlink/namespace/">
<xsl:output method="html"/>
<xsl:template match="product">
<xsl:variable name="prod-id" select="@id"/>
<h1><xsl:value-of select="title"/></h1>
<p>These files can not combined in modern browsers</p>
<h3>Other similar products</h3>
<!--
Select all similar products where
- they are different from the current product
- there is a link that
- has the correct role (i.e., product similarity)
- includes the similar product
- includes the current product
-->
<xsl:for-each select="document('products.xml')/catalog/product">
<xsl:variable name="this-prod-id" select="@id"/>
<xsl:if test="($this-prod-id != $prod-id) and
document('links.xml')/links/link
[@xlink:role='similar-products']
[loc/@xlink:href[substring(substring-after(string(),
'#xpointer(id('), 2, 5)=$prod-id]]
[loc/@xlink:href[substring(substring-after(string(),
'#xpointer(id('), 2, 5)=$this-prod-id]]">
<xsl:value-of select="title"/><br/>
</xsl:if>
</xsl:for-each>
<hr/>
</xsl:template>
</xsl:stylesheet>
Source:
Erik Wilde and David Lowe: XPath, XLink, XPointer, and XML: A Practical Guide to Web Hyperlinking and Transclusion chapter 8.4.3. Link Semantics.
There may be errors in the code that I have had no time to locate.
What are
- The implications for WebBrowsers and SeBots. (At least it should be easier to crawl and index than JavaScript and Flash.
- What are the SEO (linking) implications?
I hope for a good discussion while I am on holiday.