Subject: Re: Implementing simple XLinks using XSL
From: Eric van der Vlist <vdv@xxxxxxxxxxxx>
Date: Mon, 18 Dec 2000 23:03:45 +0100
|
Adam Van Den Hoven wrote:
>
> But it doesn't seem to work.
When the XSLT processors will support XML fragments identifiers, ie
XPointers, you will be able to write:
<xsl:copy-of select="document(@xlink:href)" />
In the meantime, the source of your problem is probably that the id()
XPath function is always selecting a node from the current document and
you need to change of document before using it.
The following sheet does what you expect (at least with XT):
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink/namespace/">
<xsl:template match="* | @* ">
<xsl:copy>
<xsl:apply-templates select="@* | *"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[@xlink:show='embed'][@xlink:actuate='onLoad']">
<xsl:apply-templates
select="document(substring-before(@xlink:href,'#'))" mode="include">
<xsl:with-param name="id" select="substring-after(@xlink:href, '#')"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="/" mode="include">
<xsl:param name="id"/>
<xsl:copy-of select="id($id)" />
</xsl:template>
</xsl:stylesheet>
Hope this helps.
Eric
--
------------------------------------------------------------------------
Eric van der Vlist Dyomedea http://dyomedea.com
http://xmlfr.org http://4xt.org http://ducotede.com
------------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|