Enhanced XSLT processor using just-in-time reflection
Mismatch = Syntactic variability
alice:me a foaf:Person
<foaf:Person rdf:about="alice/me"/>
<rdf:Description rdf:about="alice/me">
<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
</rdf:Description >
<alice:me>
<rdf:type>
<foaf:Person >
.....
XSLT becomes syntax unaware but... you need a suitable normal form (good luck with that)
Alice knows Bob and Bob knows Alice
<alice:me>
<foaf:knows>
<bob:me>
<foaf:knows>
<alice:me>
<foaf:knows>
<bob:me>
<foaf:knows>
...
</foaf:knows>
</bob:me>
</foaf:knows>
</alice:me>
</foaf:knows>
</bob:me>
</foaf:knows>
</alice:me>
<xsl:template name="main">
<xsl:apply-templates select="reflect()/Alice:me"/>
</xsl:template >
<xsl:template match="foaf:knows/*">
returns Bob:me
<xsl:template match="reflect()/Alice:me/foaf:knows/*">
Graph depth first search to the rescue!
Graph-based depth first search prevents non-termination and duplicate nodes
crc:A a foaf:Person ;
foaf:name "Alice" ;
foaf:knows crc:D .
crc:B a foaf:Person ;
foaf:name "Bob" ;
foaf:knows crc:C , crc:A .
crc:C a foaf:Person ;
foaf:name "Charlie" ;
foaf:knows crc:A , crc:B .
crc:D a foaf:Person ;
foaf:name "Dave" ;
foaf:knows crc:C .
<xsl:variable name="Node" select="enf:reflect()"/>
<xsl:template name="main">
<html>
...
<xsl:for-each select="$Node/*">
...
<xsl:for-each select=".//*[parent::foaf:knows]">
<tr>
<td>
<xsl:value-of select="@foaf:name"/>
</td>
</tr>
</xsl:for-each>
...
</xsl:for-each>
</html>
</xsl:template>