|
Subject: Re: splitting into separate files and linking From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 17 Jun 1999 21:11:24 -0700 |
At 99/06/17 22:22 +0100, Sebastian Rahtz wrote:
>Using XT's facilities, I have it almost working by borrowing stuff
>from James Clark:
>...
>This works fine, making eg "N110.html" from a <div0>. The problem
>comes when I want to put in a navigation bar. James has a plausible example:
>
><xsl:if test="from-preceding-siblings(div0)">
> <a href="{from-preceding-siblings(div0[1])/@name}.html">Previous
article</a>
></xsl:if>
>
>but this uses a `name' attribute for the div0 (which I don't have, and
>don't really want), and I do not see how to get the generated-id()
>function to do its stuff in this context.
Since generate-id() has an optional node set as an argument, you can use:
<xsl:if test="from-preceding-siblings(div0)">
<a href="{generate-id(from-preceding-siblings(div0[1]))}.html">Previous
article</a>
</xsl:if>
... as in the example below.
I hope this helps.
...... Ken
T:\ftemp>type test.xml
<?xml version="1.0"?>
<test>
<div0/>
<div0/>
<div0/>
</test>
T:\ftemp>type test.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
xmlns="http://www.w3.org/TR/REC-html40"
result-ns="">
<xsl:template match="/"> <!--root rule-->
<xsl:for-each select="//div0">
<a name="{$file}">Test</a>
<xsl:text>
</xsl:text>
<xsl:if test="from-preceding-siblings(div0)">
<a href="{generate-id(from-preceding-siblings(div0[1]))}.html"
>Previous article</a>
<xsl:text>
</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
T:\ftemp>call xsl test.xml test.xsl test.htm
T:\ftemp>type test.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<a name="">Test</a>
<a name="">Test</a>
<a href="N3.html">Previous article</a>
<a name="">Test</a>
<a href="N5.html">Previous article</a>
T:\ftemp>
--
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
Website: XSL/XML/DSSSL/SGML services, training, libraries, products.
Publications: Introduction to XSLT (3rd Edition) ISBN 1-894049-00-4
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: splitting into separate files a, Sebastian Rahtz | Thread | RE: Performance question, Earl Bingham |
| Re: splitting into separate files a, James Clark | Date | The "supercharged FONT tag": CSS vs, L. David Baron |
| Month |