[xsl] Implementing simple XLinks using XSL

Subject: [xsl] Implementing simple XLinks using XSL
From: Adam Van Den Hoven <Adam.Hoven@xxxxxxxxxxxx>
Date: Mon, 18 Dec 2000 13:21:38 -0800
Hi!

I'm using an XML document (it happens to be NewsML but that isn't really
relevant) that uses the following tag:
<xlink:simple 
   xmlns:xlink="http://www.w3.org/1999/xlink/namespace/";
   xlink:href="VIDEO_ABC123456789.xml#VIDEO_ABC123456789" 
   xlink:role="NewsComponent"
   xlink:show="embed" 
   xlink:actuate="onLoad" /> 
This is a very simple thing. What I want is a variation on the identity
transform that intercepts any element with an xlink:show="embedded" and
xlink:actuate="onLoad" and instead of copying the element, it gets the
document in the href, finds the element that has the ID refered to and
copies that nodeset into the result tree. I have a few ideas on how to do
this but I've run into problems
The identity transform (according to MS):
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:template match="/ | @* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

My first thought would be:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:template match="/ | @* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="*[@xlink:show='embed'][@xlink:actuate='onLoad']">
	<xsl:copy-of select="document(substring-before(@xlink:href,
'#'))//id(substring-after(@xlink:href, '#')) />
  </xsl:template>
</xsl:stylesheet>

But it doesn't seem to work.

Thanks!

> 		Adam van den Hoven
> 		Internet Application Developer
> 		Blue Zone
> 		tel. 604.685.4310
> 		fax. 604.685.4391
> 
> Blue Zone makes you interactive. http://www.bluezone.net/
> 
> 
> 
> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread