|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XLink transformations
Ben,
I think the problem is deeper than you described. For example:
******** XML data ********
<library xmlns="http://www.library.com">
<book>
<title>B1</title>
<author>A1</author>
<abstract>xyzzy</abstract>
</book>
<book>
<title>B2</title>
<author>A2</author>
<abstract>xyzzy</abstract>
</book>
<book>
<title>B3</title>
<author>A1</author>
<abstract>xyzzy</abstract>
</book>
</library>
********* XLink linkbase ***********
<linkbase xmlns:xlink="http://www.w3.org/1999/xlink">
<link xlink:type="extended"
xlink:title="Books by Author A1">
<resource xlink:type="locator"
xlink:href="library.xml#xpointer(book[position()=1])"
xlink:title="B1"/>
<resource xlink:type="locator"
xlink:href="library.xml#xpointer(book[position()=3])"
xlink:title="B3"/>
</link>
</linkbase>
********* XSLT stylesheet *********
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lib="http://www.library.com"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="lib:library">
<html>
<h1>Books by Author A1</h1>
<p>
These books come from library XYZ.
</p>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="lib:book[author='A1']">
<p>
<b><xsl:value-of select="title"/></b><br>
<xsl:value-of select="abstract"/>
</p>
</xsl:template>
</xsl:stylesheet>
********************************
The resulting HTML file will be (not valid, but it's only an example):
<html>
<h1>Books by Author A1</h1>
<p>
These books come from library XYZ.
</p>
<p>
<b>B1</b><br>
xyzzy
</p>
<p>
<b>B3</b><br>
xyzzy
</p>
</html>
Now the question is: Is there any chance for the browser, given the
linkbase from above, to know that there should be a link between books
B1 and B3? And if, which elements should be used as source and target
of the link? the <p> element or the <b> element? In my opinion,
there's no general solution to this problem if the complexity of
XPointer and XSLT is considered.
Michael
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








