[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XLink transformations

  • From: Michael Kraus <michael.kraus@i...>
  • Date: Tue, 18 Jul 2000 13:36:25 +0200

xlink linkbase
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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.